0
我有follwing方法Scriptmethod responseformat设置为JSON返回XML
[WebMethod]
[ScriptMethod(UseHttpGet = false, ResponseFormat = ResponseFormat.Json)]
public List<MyObject> GetMyObjects()
{
return Business.GetMyObjects();
}
,你可以看到Web方法设置为JSON,但该方法返回XML
我使用以下JavaScript访问此Web方法。
function getMyObjects() {
$.ajax({
type: "POST",
url: "/treenode/myobjects.asmx/GetMyObjects",
dataType: "JSON"
}).success(function(data) {
var response = data.d;
alert(d.param);
});
}
这可能是一个快速修复,但我错过了一些东西,不能看到它是什么。