0

我的网络服务网址是http://www.webservicex.net/globalweather.asmx

操作是 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

当我将“印度”作为输入时。

如何解决这个问题..提前谢谢

4

1 回答 1

2

我用来获取 jsonp 的 url 实际上并没有返回 json 响应。谢谢@SLaks

单击此处 如果有人想尝试,此 url 将返回 json。

于 2012-11-02T06:03:15.927 回答