Jquery WebMethods不适用于VS2013

Jquery WebMethods不适用于VS2013,jquery,vb.net,visual-studio-2013,webmethod,Jquery,Vb.net,Visual Studio 2013,Webmethod,我以前在VS2010中通过jQuery调用WebMethods的做法不再适用于VS2013。以下是页面服务代码: Imports System.Web.Services Imports System.Web.Script.Services Imports System.Web.Script.Serialization <WebMethod()> _ Public Shared Function Test() As String Dim strTest As String =

我以前在VS2010中通过jQuery调用WebMethods的做法不再适用于VS2013。以下是页面服务代码:

Imports System.Web.Services
Imports System.Web.Script.Services
Imports System.Web.Script.Serialization

<WebMethod()> _
Public Shared Function Test() As String
    Dim strTest As String = "Testing"
    Return strTest
End Function
}


你可以猜到我总是收到失败的警报。这在2010年非常有效。在文档中找不到任何新内容。

参数
数据:“[]”
不是字符串,而是对象。您必须将其更改为:

数据:{
myproperty:“值”
}


或者简单地删除数据参数

忘记添加-错误是“InternalServerError”,这通常意味着jQuery找不到您为方法指向的url。我确实在webmethod测试中设置了一个断点,但我们没有做到这一点。ajax请求中的数据不是字符串,而是对象。500通常意味着您发送的数据不正确。检查网络选项卡以确认这一点。感谢@GuyT-成功-删除了所有数据参数并成功。我还可以把它改成数据:“{}”,如果你回答这个问题,我会给它打上标记。
function TestService() {
$.ajax({
    type: "POST",
    url: "myPage.aspx/Test",
    contentType: "application/json; charset=utf-8",
    data: '[]'
})
.done(function (d) {
    alert('success');
})
.fail(function (xhr, st, err) {
    alert('failed');
});