Posts tagged ‘arraytoxlm’

If you are using library such as jQuery, it supports AJAX responses in very different formats. For example, jQuery.get supports “xml”, “html”, “script”, “json”, “jsonp” and “text”. Which to choose?
Let’s say we have these variables, which we want to pass to JavaScript:

$array = array(
’status’ => ‘OK’,
‘message’ => ‘My status message’,
‘additional’ => array(1, 2, 3, [...]