index.html
サーバーtest1.comからファイルを実行しています。Mootools ライブラリ ファイルは、このindex.html
ファイルに含まれています。
以下は、PHP ページを呼び出すスクリプトです。
<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;
?>
の実行中index.html
に、正しい出力が得られます」
{"年齢":30,"場所":"ロンドン"}
現在、ajaxtest.php
test2.com などの別のサーバーに常駐しています。上記のスクリプトを以前と同じように変更するにはどうすればよいですか?