我正在尝试从Web服务获取一些数据:
$.ajax({
type: 'POST',
url: "http://192.******.asmx?op=GetJSONString",
method: "serverCallback",
data: "Select con.cod as codigo, con.res as descripcion from con where ide>0",
success: function(data){alert(data)},
});
如何获取返回的JSON数据?
答案 0 :(得分:1)
这是我的电话的样子。你能更具体地说明你遇到的问题吗?
$.ajax({
type: "POST",
data: "SOME DATA",
dataType: "json",
url : "/myapp/service.json",
cache: false,
error: function() {
alert("There was an issue");
}
,
success: function(data)
{
processJson(data);
}
});
答案 1 :(得分:1)
我还将发布与asmx服务有关的内容。
在下面的示例中,对于“url”:“/ service /Details.asmx / Reject”,“/ Reject”是Web服务(asmx)文件中的方法名称。
$.ajax({
"dataType": 'json',
"contentType": "application/json; charset=utf-8",
"type": "POST",
"url": "/service/Details.asmx/Reject",
"data": "{\"itemId\":\"" + id + "\",\"comment\":\"" + comms + "\"}",
"success":
function (msg) {
alert("Yea it worked!");
});
}
});