Skip to content

Instantly share code, notes, and snippets.

@twinge
Created June 15, 2009 21:20
Show Gist options
  • Save twinge/130349 to your computer and use it in GitHub Desktop.
Save twinge/130349 to your computer and use it in GitHub Desktop.
<!-- Initial screen -->
These links demonstrate the Ajax object:<br />
<a href="#" onclick="do_ajax('http://mt.score.26am.com'); return false;">Test of subdomain 1</a><br />
<a href="#" onclick="do_ajax('http://www.score.26am.com'); return false;">Test of subdomain 2</a><br />
<div id="ajax1">Div content before ajax call</div>
<script><!--
function do_ajax(server) {
var ajax = new Ajax();
ajax.responseType = Ajax.FBML;
el = document.getElementById('ajax1');
if(!el.hasClassName('loading')) {
el.addClassName('loading');
ajax.ondone = function(data) {
el.removeClassName('loading');
el.setInnerFBML(data);
}
var url = server + '/ajax/test?server='+server;
ajax.requireLogin = false;
ajax.post(url);
}
}
//-->
</script>
<!-- Ajax response -->
This is an FBML string. Ajax request came through <?php echo $_GET['server']?>, and you are <fb:name uid=<?php echo $user ?> useyou=false />.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment