/ Published in: HTML
URL: http://wiki.developers.facebook.com/index.php/FBJS/Examples/Ajax
Expand |
Embed | Plain Text
These links demonstrate the Ajax object:<br /> <script><!-- function do_ajax(type) { var ajax = new Ajax(); ajax.responseType = type; switch (type) { case Ajax.JSON: ajax.ondone = function(data) { document.getElementById('ajax1').setTextValue(data.message + ' The current time is: ' + data.time + '. '); document.getElementById('ajax2').setInnerFBML(data.fbml_test); } break; case Ajax.FBML: ajax.ondone = function(data) { document.getElementById('ajax1').setInnerFBML(data); document.getElementById('ajax2').setTextValue(''); } break; case Ajax.RAW: ajax.ondone = function(data) { document.getElementById('ajax1').setTextValue(data); document.getElementById('ajax2').setTextValue(''); } break; } ajax.requireLogin = document.getElementById('requirelogin').getChecked(); ajax.post('http://example.com/testajax.php?t='+type); } //--></script>
You need to login to post a comment.
