Jquery Ajax Call does not Call the function in .CS file

后端 未结 3 1782
旧巷少年郎
旧巷少年郎 2021-01-26 02:27

Always i get the alert in the \"error\". When i debugged i get the type,url as undefined. can anyone help me why that method is not getting called??

$(document).         


        
3条回答
  •  广开言路
    2021-01-26 02:44

    The jquery Ajax method is going to post your data in json format using the plain html protocol. ASP.NET will be expecting to unwrap a SOAP request to pass to the webmethod. Thus the error. You should use an MVC action instead, as suggested in one of the comments. EDIT:On further investigation ASP.Net has an attribute that will allow the web method to be called: [System.Web.Script.Services.ScriptService]. Use this attribute on the class and it might solve your problem.

提交回复
热议问题