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。 –