$().ready(function() {
var url = 'http://localhost:9654/WebService/UserList.asmx/HelloWorld';
$.getJSON(url,"" ,function(json) {
alert("dd");
});
});
服务器已经响应了 但是 alert("dd") 执行不到
下面是服务器响应结果
<?xml version="1.0" encoding="utf-8"?>
<string xmlns="http://tempuri.org/">[{"id":"0","name":"name0"},{"id":"1","name":"name1"},{"id":"2","name":"name2"},{"id":"3","name":"name3"},{"id":"4","name":"name4"},{"id":"5","name":"name5"},{"id":"6","name":"name6"},{"id":"7","name":"name7"},{"id":"8","name":"name8"},{"id":"9","name":"name9"}]</string>
------解决方案--------------------
你的是asp.net的webservice吧,要使用$.ajax,配置contentType:'application/json',具体参考下面的文章返回json数据
jquery json webservice