I needed to make two different sub domains work together recently, producing a page on one site by using parts of another. Because they're different sites, the AJAX Same Origin Policy comes in to play, and in short it stops you from doing it.
Fortunately the solution is to use jQuery's getJSONP() function, which is not subject to those restrictions. It can take a few moments to grok what's going on here, but in essence your client side request looks like this:
function myfunc(data) {
$('#mydiv).html(data.mydata);
}
$.getJSON('http://sub.domain.co.nz/myphp.php?callback=?');and your server script looks like this:
echo "myfunc(".json_encode(array('mydata'=>'awesome')).")";The important points to note are: