WebMethod not being called

后端 未结 4 1593
-上瘾入骨i
-上瘾入骨i 2020-12-07 02:37

I am passing a javascript variable containing a string to the server via jquery.ajax. Although the \"success\" condition is called, the server-side WebMethod is never calle

4条回答
  •  忘掉有多难
    2020-12-07 03:03

    Try following fixes for your Ajax request:

     $.ajax({
                type: "post",
                url: "Playground.aspx/childBind",
                data: "{sendData: '" + ID + "'}",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (result) { alert("successful!" + result.d); }
            })
    

    Notice changed dataType and data value as a string.

提交回复
热议问题