a note on json_de/encode

I just thought I should quickly post this note simply because I know a few people might have problems with parsing it with the above functions.

I would like first to say that json_encode and json_decode are PHP 5.2.0+ methods of parsing and dealing with Javascript Simple Object Notation. basically looks a bit like this {“key”:”value”}. The idea is to be able to do useful things with objects like these and stepping through the key and value pairs while doing something with them.

The problem however is you sometimes get JSON sent as a string through an HTTP method like $_POST and the quotes in there are automatically (well in my case). escaped with backslashes like this {\”jsonkey\”:\”jsonvalue\”}. Before you actually call json_decode on your json data use the built in stripslashes function first. so your code should look like this in one line

$json_array = json_decode(stripslashes($jsonObject));

hope this helps someone.

bug with fcbkcomplete when loading through ajax

If you find that your jquery autocomplete plug-in specifically the fcbkcomplete variant works nicely when you load the entire document, but doesn’t work when you make requests through ajax to display the content in a dv tag, you might want to try this.

Basically if it’s inited in a page that was requested through ajax with content passed into a div tag. It doesn’t display the autocomplete suggestions. I found this but to be caused by width being set to “0px” in the message_to_feed <li> attribute.

My workaround for this was to add
feed.css(“width”, “512px”); // set to default width

on lines 407, and 416 in jquery.fcbkcomplete.js.

I have commented on this on the developers site hope he picks it up.