Hi I have very little experience with asp.net webforms but I have a situation where I have to execute an ajax call on the server every time the application is started or the page is changed.
Taking that into consideration I have added this method in the MasterPage.Master file:
[WebMethod]
public static void DeleteUnpostedDocumentsFromFileShare()
{
var ceva = "I was called";
}
And added a brakepont to it so I can see when it is called.
This is the ajax call I am creating:
$(document).ready(function() {
$.ajax({
type: "POST",
url: "/Masterpage.Master/DeleteUnpostedDocumentsFromFileShare",
contentType: "application/json; charset=utf-8",
success: function(data) {
alert(data);
},
error : function(data , data2 , data3) {
alert(data);
}
});
})
The problem is that this call returns the content of the html page instead of calling the method I needed.
Can anyone tell me what I am doing wrong?