我试图制作一个适用于所有桌面浏览器的JSONP请求,但它不适用于iPhone和Android。
我正在对Web服务进行跨域调用,该服务返回如下的JSONP:
myFunction({name : "Jonh", last : "Doe"})
$.ajax({
type: "GET",
crossDomain: true,
url: "http://192.168.1.41:8081/Service1/",
dataType: "jsonp",
processData : true,
headers: {
"Content-Type": "application/json"
},
jsonp : "myFunction",
jsonpCallback: "myFunction"
});
function myFunction(data)
{
alert("Hello world!");
}
它适用于DESKTOP但不适用于移动设备!
有什么想法吗?
答案 0 :(得分:0)
我的问题是我从http服务器(我的开发机器)发送JSONP请求到https服务器。
完全清楚它的外观
从http://localhost.com向https://api.xxx.com
请求除了移动游猎之外,它适用于所有浏览器。
http - > http =工作
https - > https =工作
http - > https =不工作