0

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?

yoka
  • 55
  • 8
  • Maybe it's not going to the error function, it's reloading in the success function. Try alert in the success to make sure where the reload is being called. – adolfotcar Jul 22 '14 at 14:33
  • It's not working also in the success function. I get this: "Uncaught Error: cannot call methods on listview prior to initialization; attempted to call method 'refresh'" – yoka Jul 22 '14 at 14:40
  • You need to know about [this](http://stackoverflow.com/questions/10876244/browser-support-for-window-location-reloadtrue) especially the last answer – Salathiel Genese Jul 22 '14 at 14:45

0 Answers0