Windows phone 7 - 没有post数据jQuery ajax调用 [英] Windows phone 7 - no post data for jQuery ajax calls
问题描述
我正在为Windows Phone 7开发一个 PhoneGap 应用程序,我正在进行一些jQuery AJAX调用。具体来说,我将登录POST数据发送到远程脚本。
I'm developing a PhoneGap application for Windows Phone 7 and I'm doing some jQuery AJAX calls there. Specifically, I'm sending login POST data to a remote script.
当我们的脚本在POST数据中接收到这些登录凭据时,响应是JSON,否则返回HTML
The response is in JSON when our script receive these login credentials in POST data, otherwise it returns HTML of a full login page.
我相当肯定:
- 我已允许跨域请求使用 $。support.cors = true $ .mobile.allowCrossDomainPages = true
- 设置 cache:false
- 将数据作为JSON对象无效
- 无法使用contentType值操作
- I've got the domain whitelisted
- I've allowed cross-domain requests using $.support.cors = true and $.mobile.allowCrossDomainPages = true
- it is not an issue with setting cache: false (already played around with it)
- passing data as JSON object doesn't work either
- playing around with contentType values did not help
当我尝试POST方法时,没有发送到实际脚本的帖子数据。
When I try POST method, however there are no post data being transferred to the actual script.
我发现了一个旧的类似问题,它已链接到桌面Internet Explorer。在我的情况下,我无法发布数据 - 不是第一次尝试,不是第二次或任何其他后续尝试。
I have found an old similar problem which was linked to a desktop Internet Explorer. In my case, however I'm not able to post data at all - not on 1st try, not on 2nd or any other subsequent try.
$.ajax({
url: "http://www.mypage.com/",
type: "post",
data: "login="+$('#login').val()+"&pw="+$('#pw').val(),
dataType: "json",
cache: false,
success: function(loginReturn, status, request) {
// all ok - we never get here on Windows Phone 7
}
});
推荐答案
PhoneGap for Windows Phone jQuery ajax回调未执行
和
http://shareourideas.com/2012/03/04/phonegap-and-jquery-ajax-call-post-in-windows-phone/
这篇关于Windows phone 7 - 没有post数据jQuery ajax调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!