I tryed to use some AJAX in my MasterPage file, but got this error :
http://localhost:15354/website/MasterPage.master/Login Failed to load resource: the server responded with a status of 403 (Forbidden)
I red on some forums that we can’t call a function with AJAX from a MasterPage like this :
function Login() {
var obj = new Object();
obj.user = "";
obj.pass = "";
$.ajax({
type: "POST",
url: "MasterPage.master/Login",
data: JSON.stringify(obj),
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (result) {
alert("success");
},
error: function (){
alert("error");
}
});
}
Here is my function in the code behind :
[WebMethod]
public static string Login(string user, string pass)
{
return "";
}
How do I do that?
Thank you very much!
Better to have webservice for this and call the webservice url from ajax request.