I want to call code behind method from client side ajax request. It returns success but it never goes inside this method. Here is my code:
Code Behind:
[WebMethod]
public static void Test()
{
var ceva = "I was called";
}
javascript ajax request:
$.ajax({
type: "POST",
url: "/Default.aspx/Test",
contentType: "application/json; charset=utf-8",
success: function(data) {
alert('success');
},
error : function(data , data2 , data3) {
alert('failed');
}
});
data: {}) and adddataType: "json"