call method in code behind from JQuery
Posted
by brajt
on Stack Overflow
See other posts from Stack Overflow
or by brajt
Published on 2010-06-11T08:47:20Z
Indexed on
2010/06/11
8:52 UTC
Read the original article
Hit count: 223
jQuery
I am trying to execute a method in ASP.NET from Jquery
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: "MyMessages.aspx?id=66&epslanguage=sv/test",
data: "{}",
dataType: "json",
error: function(xhr, err) {
alert("readyState: " + xhr.readyState + "\nstatus: " + xhr.status);
alert("responseText: " + xhr.responseText);
},
success: function() {
alert("it works" );
}
})
code behind:
[WebMethod]
protected void test()
{
test.Text = "works";
}
I get errormessage redayState: 4 and status 200 when I do this. I don't understand the problem. I am vey new at this. :)
© Stack Overflow or respective owner