2015-01-14 43 views
0

我想插入前重定向頁面,當某些情況發生時,頁面在firebug中成功重新載入。重定向頁面插入雜貨店前

我的代碼:

$crud->callback_before_insert(array($this,'callback_function')); 

功能:

$getRow1= $this->db->where('nationalityID',$getRow->id)->get('table_name')->row(); 

$data = array('courseID'=>$courseID,'userID'=>$getRow1->id); 
$insert= $this->db->insert('table_name1',$data); 

if($insert) { 
    $newlink = base_url()."admin/control_trainee_courses/data/". $courseID; 
    echo "<script>" . "window.location = '$newlink';</script>"; 

    // or using redirect(base_url()."index.php/admin/control_trainee_courses/data/".$courseID ; 
} 

請幫助。

回答

3
echo ("<SCRIPT LANGUAGE='JavaScript'>top.location.href='/index.php/';</SCRIPT>"); 
exit(); 

它會結束代碼執行,所以不會發生插入。

此外,請確保您重定向到相同的域,否則瀏覽器將阻止重定向。

-1

,你可以使用網址助手和重定向

redirect(base_url(), 'refresh'); 
+0

沒有,也沒有工作,我提到,在我的問題 – MYoussef