jquery - Redirecting after Ajax post -
i want success on ajax post go home page. reason keep doing wrong. idea should fix this?
window.app_root_url = "<%= root_url %>";
ajax
$.ajax({ url: '#{addbank_bankaccts_path}', type: 'post', beforesend: function(xhr) {xhr.setrequestheader('x-csrf-token', '#{form_authenticity_token}')}, datatype: "json", data: 'some_uri=' + response.data.uri , success: function(app_root_url) { window.location.assign(app_root_url); } });
success: function(response){ window.location.href = response.redirect; }
hope , had same problem
Comments
Post a Comment