0
我正在制作一个jQuery Mobile和PhoneGap应用程序。我需要提交一份表格。我做了这样的事情:JSONP不工作
$.ajax(
{
url: 'http://ip.ip.ip.ip:8070/services/rest/operator/login',//?email=' + email + '&password=' + haslo,
dataType: 'jsonp',
type: 'GET',
callback: 'jsonpCallback',
jsonpCallback: 'jsonpCallback',
jsonp: '_jsonp',
data: ({'email' : email, 'password' : pass}),
contentType: 'application/x-www-form-urlencoded',
success: function (data) {
window.location = ('file:///android_asset/www/custom/main.html');
},
error: function (data) {
alert('Login i/lub hasło nieprawidłowe '+data);
}
});
它适用于Chrome,但不在我的Android设备上。我阅读了PhoneGap和jQuery Mobile的文档,我尝试了白名单,$ .mobile.allowCrossDomainPages和$ .support.cors。据我所知,PhoneGap允许跨域,我也尝试将数据类型更改为json。
不幸的是,我无法访问服务器端代码。我只是有这么短的“wadl”。 Web服务返回200成功或401访问被拒绝。
<resource path="/operator">
<resource path="/login">
<method name="GET">
<request>
<representation mediaType="application/x-www-form-urlencoded">
<param name="email" style="query" type="xs:string"/>
<param name="password" style="query" type="xs:string"/>
</representation>
</request>
<response>
<representation mediaType="application/octet-stream"/>
</response>
我在想什么?
注意:只有一次我收到[object Object]错误消息。但我不知道如何:)
如果webservice没有返回JSON-P,那么你不能使用JSON-P! – Quentin