【发布时间】:2014-11-20 09:53:54
【问题描述】:
您好,我正在使用带有 web 服务的 ajax 将表单信息添加到数据库中:
网络服务代码是:
[WebMethod]
public string HelloWorld() {
return "Hello World";
}
而ajax是:
$.ajax({
type: "GET",
url: "WebService.asmx/HelloWorld",
data: {},
contentType: "application/x-www-form-urlencoded; charset=UTF-8",
dataType: "text",
success: function (data) {
alert(date);
},
failure: function (msg) { alert("Sorry!!! "); }
});
但是当我运行代码时,我得到了这个错误:
GET http://localhost:53145/Group/WebService.asmx/HelloWorld 500 (Internal Server Error)
有人可以帮我吗? ajax代码和webservice在同一个文件夹,名字对吗?
【问题讨论】:
-
扩展名 .asmx 不受支持,或者您可以将其路由,因此将其删除
-
它对我不起作用
标签: jquery asp.net ajax web-services