How to redirect user to another page after Ajax form submission

前端 未结 7 597
既然无缘
既然无缘 2020-12-11 03:54

I\'m having problems redirecting the user to a thank you page after a successful form completion. What happens is that after the form submits, it goes to a blank page (https

相关标签:
7条回答
  • 2020-12-11 05:00

    You should use

    window.location.href = "http://www.google.com";
    

    and not

    location.window.href = "http://www.google.com";
    

    http://www.w3schools.com/js/js_window_location.asp

    The success should be a the functtion passed as an argument to $.ajaxForm:

    $('#theForm').ajaxForm(function() { 
               window.location.href = "redirect user to the thank you page";
            }); 
    
    0 讨论(0)
提交回复
热议问题