2010-08-07 38 views
4

我應該從服務器迴應什麼數據以重新定向我的頁面?再說了,想這我的jquery: -如何重定向頁面? jQuery

$.ajax({ 
      type: "POST", 
      url : '<?php echo base_url() ?>Admin/AddNotice', 
      data: {noticeTitle: $('#title').val(),noticeDesc : $('#desc').val() }, 
      success: function(msg){ 
       //here i want to redirect..fill in the blank please. 
      } 
     }); 

感謝提前:)

+11

「ajaxically」是我最喜歡的詞。 – 2010-08-07 15:10:14

回答

12

這是很容易:

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

;)

5

我不知道你是什麼意思「ajaxically重定向」,但如果你只是想瀏覽器重定向到另一個頁面,則可以使用window.location = 'http://wherever/you/want/to/go/';

7

使用:

success: function(msg){ 
    window.location = "page.html"; 
}