Web Service method name is not valid

后端 未结 8 2879
余生分开走
余生分开走 2021-02-20 04:39

I get the following error \"Web Service method name is not valid\" when i try to call webmethod from javascript

System.InvalidOperationException: SaveBO

8条回答
  •  故里飘歌
    2021-02-20 05:08

    Try using this, I think datatype should be JSON

           jQuery.ajax({
                type: "POST",  // or GET
                url: "/AllService.asmx/SaveBOAT",
                data: { Pid: b },
                contentType: "application/json; charset=utf-8",
                dataType: "json"
                success: function(dd) {
                    alert('Success' + dd);
                },
                error: function(dd) {
                    alert('There is error' + dd.responseText);
                }
            });
    

    And in C# Code change Pid to string

        [WebMethod]
         public static string SaveBOAT(string Pid)
         {        
          SessionManager.MemberID = Pid;
          return "";
         }
    

提交回复
热议问题