Talk:FBJS/Examples/Ajax

From Facebook Developer Wiki

< Talk:FBJS
Revision as of 15:16, 28 April 2009 by Yeshiva Orgil (Talk | contribs)
(diff) ←Older revision | Current revision (diff) | Newer revision→ (diff)
Jump to: navigation, search

I don't get the first example to work. FBML and RAW modes work but the JSON mode returns objects that have value undefined. I've checked and the server returns valid JSON string, so the problem must be in the Facebook JSON decoder. My server returns UTF-8 data, I wonder if Facebook JSON is incompatible with UTF-8. JSON standard requires UTF-8 compatibility though. 735301901 08:48, 16 September 2008 (PDT)

Works for me. Thanks for the code, Matt.


I'm not having any luck getting this example to work in FF or IE. Any suggestions?

Me too. I've tried using this exact example MANY times and there's definitely something wrong.

It works in Firefox for me, but not IE or Safari. I am trying it on each <option> of a <select> box. clickrewriteid and clickrewriteurl don't work either in IE or safari using this method 683545112 00:39, 17 August 2007 (PDT)


I copied the code and could't get it to work at first, I got the following in firebug:

"There was an uncaught Ajax error. Please attach on onerror handler to properly handle failures."

with RESPONSE:

for(;;);{"error":true}

Then I found I had not got the whole url in the post, and changed it to:

ajax.post('http://my_full_callback_url/testajax.php?t='+type);

and it worked fine! Make sure you have the full address (not app canvas page).

Hope this helps somebody. 512493462 05:17, 24 October 2007 (PDT)

Hello, Is Ajax.JSON response format changed? The following code was working for me for couple of months but today I found JSON object is NULL in AJAX response.

echo '{"fbml_message":"'. $mess_str .'", "statusFlag":"'.$status.'", "redirectURL":"'. $redirect_str .'"}';

Yes, this was announced on the Developer blog and the Developer Forum. An engineer tells me you should avoid building your own JSON, and instead opt for the PHP function json_encode, as it has pretty wide support nowadays. -- Pete (563683308 12:38, 24 January 2009 (PST))

I had a problem with this.

It got fixed when I added params into the post function, even though it was empty:

This didn't work:

ajax.post("<?=$url?>");

This did:

var params = "";
ajax.post("<?=$url?>", params);

Good luck! 561653048 08:16, 28 April 2009 (PDT)

reference