0
我的web网址是http://www.webservicex.net/globalweather.asmx的jQuery +跨域+ AJAX + Web服务调用
,操作GetCitiesByCountry
$.ajax({
type: 'POST',
url: "http://www.webservicex.net/globalweather.asmx?op=GetCitiesByCountry",
data: "{'CountryName':'" + user + "'}",
contentType: "application/json; charset=utf-8",
dataType: "jsonp",
crossDomain: true,
success: function (msg, status) {
alert("successful");
console.log(msg.d);
},
error: function (msg, status) {
alert("failure");
console.log("failure");
console.log(msg);
$('#myplace').html("The status is " + status + " with msg= " + msg + " .<br />" + msg.statusText + " .<br />" + msg.responseText + " .<br />" + msg.status);
}
});
,但我得到了下面的错误。
The status is parsererror with msg= [object Object] .
success .
undefined .
200
当我把“印度”作为输入。
如何解决这个issue..thanks提前
这不是JSONP服务。 – SLaks
您无法使用JSONP进行POST,此外,您不能在不实施CORS的情况下跨域进行POST,而这在oldie中不起作用 –
如何实现cors?如何检查服务是否是jsonp。 –