Hey,
I have this AJAX code, but it doesn't seem to throw the 'alert' method. Instead, nothing happens. I looked at it with Fiddler and got this error message:
{"Message":"There was an error processing the request.","StackTrace":"","ExceptionType":""}
I'm trying to call a web method in the code-behind called MyWebMethod
:
$.ajax({ type: "POST",
url: "Test.aspx/MyWebMethod",
data: "{" + username + "}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function() {
alert("success");
},
fail: function() {
alert("Fail");
}
});
The web method worked fine when I had a script manager on the page, but I want to remove the script manager and thought that using AJAX would be the best way.
Thanks