1

我正在尝试从 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 数据?

4

2 回答 2

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!");
                            });
                        }
        });
于 2012-05-23T14:43:39.407 回答
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); 
    }
});
于 2012-05-23T14:20:28.377 回答