I am executing an index.html
file from the server test1.com. Mootools library file is included in this index.html
file.
Following is a script that calls a PHP page:
<script>
var request = new Request.JSON({
url: 'http://test1.com/ajaxtest.php',
onSuccess: function(data) {
// the request was completed.
alert(JSON.stringify(data));
}
}).send();
</script>
ajaxtest.php
<?php
$arr['age'] = 30;
$arr['place'] = 'London';
echo json_encode($arr); exit;
?>
While executing index.html
, I'm getting the correct output"
{"age":30,"place":"London"}
Now, ajaxtest.php
is residing on another server, say test2.com. How to change the above script to make it work as earlier?