Javascript 如何在vb.net中从aspx.vb页面调用webmethod
我想做的是,从aspx.vb调用WebMethod,下面是我的WebMethod语法,它在Default.aspx.vb中Javascript 如何在vb.net中从aspx.vb页面调用webmethod,javascript,jquery,asp.net,vb.net,Javascript,Jquery,Asp.net,Vb.net,我想做的是,从aspx.vb调用WebMethod,下面是我的WebMethod语法,它在Default.aspx.vb中 <System.Web.Services.WebMethod()> _ <ScriptMethod(UseHttpGet:=True, ResponseFormat:=ResponseFormat.Json)> _ Public Shared Function dat( _ ByVal Id As Integer) As List(Of items)
<System.Web.Services.WebMethod()> _
<ScriptMethod(UseHttpGet:=True, ResponseFormat:=ResponseFormat.Json)> _
Public Shared Function dat( _
ByVal Id As Integer) As List(Of items)
Dim eve As New List(Of items)()
eve = (From row In getItems(Id).Rows
Select New items With {
.Name = row("Name").ToString(),
.Description = row("Description").ToString(),
.ItemPic_url = row("ItemPic_url").ToString()}).ToList()
Return eve
End Function
下面是我调用web方法的jquery函数:
注意:我的Jquery函数放在母版页中,我从startup Default.aspx页面调用它
问题:我没有输入我的web方法。通过尝试从浏览器调试。我得到的错误如下所述:
Unknown web method dat.
Parameter name: methodName
at System.Web.Script.Services.WebServiceData.GetMethodData(String methodName)
at System.Web.Handlers.ScriptModule.OnPostAcquireRequestState(Object sender, EventArgs eventArgs)
at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
我正在做的是从aspx.vb调用WebMethod 下面是我的WebMethod语法,它位于Default.aspx.vb中:
<System.Web.Services.WebMethod()> _
<ScriptMethod(UseHttpGet:=True, ResponseFormat:=ResponseFormat.Json)> _
请看线。也许这对你有帮助。
<System.Web.Services.WebMethod()> _
<ScriptMethod(UseHttpGet:=True, ResponseFormat:=ResponseFormat.Json)> _
Imports System.Web.Services
Imports System.Web.Script.Services