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).
Hi all i just used the jquery file hosted with google.
It worked out fine.
Previously i was using the jquery version 1.7.1 that i had downloaded and stored in my local. I also saw a lot of questions in the forum that this particular ajax call is quite not happening properly with .NET 4. I am not sure and forgive me if i am wrong but i do have a feeling that 1.7.1 in this case is not properly working with ASP.NET 4.
P.S -> I used this in the script tag --> src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"
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.
If im correct you should be using static method for these purposes, so function in your code behind should look like this
[WebMethod]
public static void jQueryAjaxCalledMethod()
{
//SOME CODE HERE
}
If you still get some errors take a look on this guy blog Encosia maybe you'll find there a solution