Possible Duplicate:
PHP web service not working from jQuery AJAX如何使用jQuery ajax調用RESTful php web服務?
我已經在本地創建envirnoment PHP Web服務
網址是:
http://localhost:5454/kisan-06/index.php?option=com_api&format=raw&app=users&resource=login&key=dfd8a84f8cdce807ae1d30a838415ea37eaa075c
我在我的Android應用程序的PhoneGap調用此使用jQuery.ajax。
Ajax調用是:
$.ajax({
type: "POST",
url: "http://localhost:5454/kisan-06/index.php?option=com_api&format=raw&app=users&resource=login&key=dfd8a84f8cdce807ae1d30a838415ea37eaa075c",
data: "{ username: '[email protected]', password: '123456'}",
contentType: "application/json; charset=utf-8",
cache : false,
dataType: "json",
success: function(data) {
alert("in success");
},
error: function(){
alert("There was an error loggin in");
}
});
每次錯誤回調獲取的叫,我不能跟蹤誤差。請幫助我。
更換你'錯誤。告訴我們這些是什麼。另外,在瀏覽器中按F12,運行你的AJAX查詢,然後進入網絡選項卡,並告訴我們在那裏發生了什麼錯誤。 – Scotty
@Scotty實現的變化... ** textStatus ** =錯誤和** errorThrown ** =空 在瀏覽器獲取**加載取消**爲index.php –