Reference Guide
facebook FBML Reference Guide Page 153 of 159
AJAX
FBJS supplies a very powerful AJAX object for developers. Facebook proxies all AJAX requests and optionally
runs useful post-processing on the data returned, such as JSON, or FBML parsing. To use it, just instantiate a
new AJAX class. It supports the following properties:
ondone(data)
An event handler which fires when an AJAX call returns. Depending on .responseType, data is an object, a raw
string, or an FBML string.
onerror
An event handler that fires when an error occurs during an AJAX call.
requireLogin
If you set this to true the AJAX call will require the user to be logged into your application before the AJAX call
will go through. The AJAX call will then be made with the regular fb_sig parameters containing the user's
identity. If they refuse to login, the AJAX call will fail.
responseType
This can be one of Ajax.RAW, Ajax.JSON, or Ajax.FBML.
useLocalProxy
Beta. If this is true and you are using RAW or JSON type, the Ajax object will attempt to use fb:local-proxy to
make a direct call to your app server. See FBJS_LocalProxy for more details.
Ajax.RAW
The response from your server is returned to your callback in its original form.
Ajax.JSON
The response from your server is parsed as a JSON object and returned to your callback in the form of an
object. Properties of your JSON object that are prefixed with "fbml_" are parsed as individual FBML strings
and returned as FBML blocks. These blocks can be used on a DOM object with the setInnerFBML method.
Each variable and its value in the response is limited to a combined length of 5000 characters. Note: be sure to
use json_encode or else you may see odd results with large data sets. See Bugzilla #363 for more information.
json_encode is available by default in most PHP5 installations, and implementations for many other languages
are available at json.org.
Ajax.FBML
The response from your server is parsed as FBML and returned as an FBML block. This block can used on a
DOM object with the setInnerFBML method.
And two methods:
post(url, query)
Start an AJAX post. url must be a remote address, and query can be either a string or an object that is
automatically converted to a string.
abort()
Aborts an AJAX post.
Here's an example showing most of the functionality of AJAX: Ajax Example
Dialogs
Dialog is an object we've created to allow you to hook into our base dialog abstractions. It allows you to create
rich and fully dynamic dialogs for your application.
Dialog(type)
www.yapish.com










