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);
});
}
這可能是一個快速修復,但我錯過了一些東西,不能看到它是什麼。