Welcome Guest, Not a member yet? Register   Sign In
when deleting record from DB the page cannot be rediirected using AJAX
#3

An AJAX response sends all output to the AJAX success callback.

What you need to do is use the "status" property as returned to success to decide what action to take - in your case a redirect via JavaScript.

Assuming you're using JQuery, the JS looks roughly like this...

Code:
success: function(data)
{
    if(data.status == 'success'){
        window.location.replace("http://example.com/users/upload");
    } else {
         //show the error message somewhere
        $(someSelector).text = data.msg;
    }
}

In case it's not clear, remove any redirect calls from the controller method
Reply


Messages In This Thread
RE: when deleting record from DB the page cannot be rediirected using AJAX - by dave friend - 10-04-2018, 11:52 AM



Theme © iAndrew 2016 - Forum software by © MyBB