fisrtTest.php で JSON オブジェクトを作成します WampServer でこのページを開くと JSON が正しい..
しかし、私はAjaxリクエストを行うことができません:/なぜですか? クロス ドメイン ポリシー ?
$.getJSON('http://localhost/tests/fisrtTest.php', success ); function success(data) { }
これは phonegap を使用するモバイル アプリ用です。
fisrtTest.php で JSON オブジェクトを作成します WampServer でこのページを開くと JSON が正しい..
しかし、私はAjaxリクエストを行うことができません:/なぜですか? クロス ドメイン ポリシー ?
$.getJSON('http://localhost/tests/fisrtTest.php', success ); function success(data) { }
これは phonegap を使用するモバイル アプリ用です。
あなたのエラーは何ですか?firebug コンソールで JSON 応答を表示できますか? 以下は作業コードです
$(document).ready(function(){
$("#ibutton").click(function() {
alert("go");
$.ajax({
url: "http://localhost:8080/tests/fisrtTest.php",
dataType: "jsonp",
crossDomain: true,
jsonpCallback: "CallBackFunction"
});
});
});
function CallBackFunction(json){
//
};