我是 Web 服务的新手,当我尝试在 Chrome 控制台中运行我的页面(本地)时出现以下错误
错误
加载资源失败:服务器响应状态为 405(不允许方法)
http://localhost:12015/myWebService.asmx?op=GetCategories
以下是相关代码:
jQuery
$.ajax({
url: "http://localhost:12015/myWebService.asmx?op=GetCategories",
type: "POST",
------------
------------
success: function (data) {
var categories = data.d;
$.each(categories, function (index, category) {
category.CategoryId).text(category.CategoryName);
});
},
error: function (e) { //always executing 'error' only
alert("hello");
}
网络服务网址
http://localhost:12015/myWebService.asmx
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public List<Categories> GetCategories()
{
//code
}
页面网址
http://localhost:11761/Default.aspx
编辑:当我刚刚包含时错误消失了dataType: 'jsonp'
但现在还有另一个错误。
未捕获的 SyntaxError:意外的令牌 <
:12015/myWebService.asmx?op=GetCategories&callback=jQuery183010907560377381742_1356599550427&{}&_=1356599550438:3
当我单击链接(在错误中提到)时,它正在显示页面。那么可能是什么问题?我不知道错误的含义(以及要显示的代码部分)。请帮忙。
有关的