How do I redirect a page in jQuery?

后端 未结 3 1282
后悔当初
后悔当初 2021-01-05 14:55

How what data should I echo from the server to ajaxically redirect my page? Say, suppose this my jQuery:

$.ajax({
            type: \"POST\",
            url         


        
相关标签:
3条回答
  • 2021-01-05 15:17

    It's pretty easy:

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

    ;)

    0 讨论(0)
  • 2021-01-05 15:28

    Use:

    success: function(msg){
      window.location = "page.html";
    }
    
    0 讨论(0)
  • 2021-01-05 15:41

    I don't know what you mean by "ajaxically redirect", but if you simply want the browser to redirect to another page, you can use window.location = 'http://wherever/you/want/to/go/';

    0 讨论(0)
提交回复
热议问题