• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
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

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.