I am trying to send alert Error. I wrote this code:
function doSomthing(){
var x= $("#MyText").val();
$.ajax({
type: "GET",
url: "myUrl",
dataType: "json",
data: {
Text : tParm },
contentType : "application/json; charset=utf-8",
success : function(data) {
location.reload(true);
},
error : function(jqXHR, textStatus, errorThrown) {
alert("Message");
location.reload(true);
}
});
}
I want that when I get error:
1. Doing refresh. working! (location.reload(true);
)
2. Showing alert error. not working! (alert("This Item is not Exist");
).
what is the problem?