[英]JQuery Ajax only work with synchronous Ajax call and no response for asynchronous Ajax call
I updated my app's phonegap from 0.9.3 to 2.2.0 and also jQuery from 1.4.4 to 1.6.4. 我将应用程序的phonegap从0.9.3更新到了2.2.0,还将jQuery从1.4.4更新到了1.6.4。 I tested the apps on a few device.
我在一些设备上测试了这些应用程序。
The app are currently using asynchronous call and not able to receive response from server. 该应用程序当前正在使用异步调用,无法接收来自服务器的响应。 I tested the app using synchronous call and everything is working fine(able to send and receive response form server).
我使用同步调用测试了该应用程序,并且一切正常(能够发送和接收来自服务器的响应)。 The reason why I wanted to use asynchronous call is that I don't want to lock up the screen.
我之所以要使用异步调用,是因为我不想锁定屏幕。
Anyone have any idea regarding this problem ? 有人对这个问题有任何想法吗?
Below is my code. 下面是我的代码。
$.ajax({
type: "GET",
username: uname,
password: pword,
cache: false,
data: null,
url: baseURL+'weeks',
dataType: "xml",
contentType: "application/xml;charset=utf-8",
crossDomain: false,
error: loginErrorHandler,
success: weeksParse,
});
Try removing the "," from the success function: 尝试从成功函数中删除“,”:
$.ajax({
type: "GET",
username: uname,
password: pword,
cache: false,
data: null,
url: baseURL+'weeks',
dataType: "xml",
contentType: "application/xml;charset=utf-8",
crossDomain: false,
error: loginErrorHandler,
success: weeksParse // <----------- remove the last comma ','
});
and see if this works for you. 看看这是否适合您。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.