i have this jquery code
$("#ProfileBtn").click(function () {
if (true) {
$.ajax({
type: "POST",
url: "sMaster.Master/outClick",
data: "{}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function () {
alert("~");
location.reload();
},
error: function () {
alert("!");
}
});
}
});
that calls the asp.net function:
[ScriptMethod, WebMethod]
public static void outClick()
{
}
when i try it using chrome or firefox everything is fine (alert(“~”)), but on Internet Explorer it fails (alert(“!”)).
any idea why..?
update: i’ve tried putting this instead of the error:
error: function (jqXHR, textStatus, errorThrown) {
alert(jqXHR);
alert(textStatus);
alert(errorThrown);
}
and what i get in the alerts is:
[object XMLHttpRequest]
error
undefined
i’ve also tried jqXHR.Status and it gave me 404 in the alert.
As far as I understood the problem is that ajax (maybe only in IE) can’t call functions from master page. (I tried moving the jQuery and asp.net function to an aspx and aspx.cs page and it all worked)
Thought I did also find a better way to do what I intended.
Thanks anyway.