jQuery AJAX cross domain

Use JSONP. jQuery: $.ajax({ url:”testserver.php”, dataType: ‘jsonp’, // Notice! JSONP <– P (lowercase) success:function(json){ // do stuff with json (in this case an array) alert(“Success”); }, error:function(){ alert(“Error”); } }); PHP: <?php $arr = array(“element1″,”element2”,array(“element31″,”element32”)); $arr[‘name’] = “response”; echo $_GET[‘callback’].”(“.json_encode($arr).”);”; ?> The echo might be wrong, it’s been a while since I’ve used php. In … Read more