Hello there! js:
var paramStr = $('#id1').val() + '|' + $('#id2').val() + '|' + $('#id3').val();
paramStr = '{"searchCriteria": "' + paramStr + '"}';
$.ajax({
type: "POST",
url: "/MyService.asmx/MyWebMethod",
data: paramStr,
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(result) {
}
});
VB.NET:
<System.Web.Script.Services.ScriptService()> _
<System.Web.Services.WebService(Namespace:="http://tempuri.org/")> _
<System.Web.Services.WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<ToolboxItem(False)> _
Public Class LogisticsMainMenuService
Inherits System.Web.Services.WebService
<WebMethod(EnableSession:=True)> _
<ScriptMethod(ResponseFormat:=ResponseFormat.Json)> _
Public Function MyWebMethod(ByVal searchCriteria As String) As String
Dim dummy as Integer = 1
.
.
Return someResult
End Function
End Class
I put a break point inside MyWebMethod. When I invoke this call on the page, the break point never gets hit. It works fine when I remove all parameters from MyWebMethod's signature and pass in '{}' from JS as parameters. Once I try to pass in a string parameter, it stops working. Any suggestions? Thanks!