【发布时间】:2014-02-25 06:46:03
【问题描述】:
我在使用$.getJSON 时遇到问题,因为我总是收到错误“Request format is unrecognized for URL unexpectedly ending in '/GetBranches'”
这是我的代码:
$.getJSON('testWS.asmx/GetBranches', function (data, status, xhr) {
console.log(data);
});
这是web service的代码
[WebMethod]
[ScriptMethod(UseHttpGet = true, ResponseFormat = ResponseFormat.Json)]
public List<BranchesModel> GetBranches()
{
return BranchesBLL.Instance.GetBranches();
}
我的网址有什么问题?我怎样才能解决这个问题,以便我可以使用 $.getJSON 函数?
【问题讨论】:
-
尝试使用小案例 dataType: 'json'
-
一个是
GET另一个是POST
标签: c# jquery asp.net json web-services