location.href in jquery ajax success is not triggered -
I am using jquery $ .jax to send json data as a post request to my internal server. I am able to get feedback, but on the success ceremony, while console.log works, but not instantaneous line space Href = '/ users'; Even if I have location.href in success alone, it has not been triggered. Below is my code sample
& lt; Script type = 'text / javascript' & gt; Function submitData () {var payload = {'fullname': $ ('# fullname'). Val (), 'Username': $ ('#username'). Val (), 'email': $ ('# email') .val (), 'password': $ ('#password'). Val (),}; Var onSuccess = function (data, textstat, jqXHR) {console.log (jqXHR.status); Location.href = "/ thankyou.html"; }; $ .AJX ({Type: 'Post', Async: False, URL: '/ User', Content Type: 'Application / Jason', Data Type: 'Jason', Data: JSON Stringuev (Payload), Success: Onsut ,}); } & Lt; / Script & gt;
I have also tried the window. Location, window.location.href, window.location.assign (), no one seems to be working in the above code. But oddly, when I define a full callback for AJAX and give some warning, location.href works hardly on success (but not every). I have also seen similar questions and have tried those answers, but it does not seem that it is fine. Async = true, there is a broken pipe error on my flask server.
Try calling it this way:
Your code for AJAX calls is also an error on ,
, which is an error.
Comments
Post a Comment