2012-06-14 242 views
-1

我正在使用CodeIgniter構建我的網站的jquery移動版本。 但我有重定向問題。重定向不起作用

例如: 我在頁面«listComment»和我要添加評論。 當我添加它,功能«添加評論»啓動,並在此 函數我被重定向到«listComment»。 但我不知道爲什麼我在頁面上:www.mysite.com/mycontroller/AddComment 而不是www.mysite.com/mycontroller/listComment。 我看不到我的評論,如果我刷新我有很多錯誤 ,因爲我不在良好的頁面上。

我真的希望有人可以幫助我,我不明白爲什麼重定向不 工作在我的iPhone上,它適用於我在我的電腦上嘗試移動版本。

在這裏,我使用的代碼,但我不知道哪裏是麻煩,因爲代碼工作在我的電腦上罰款:

<?php  function add_comment_unite() 
{ 
    $data['users_online'] = $this->get_users_online(); 
    $data['uniteName'] = $this->uniteName(); 
    $data['numberInvit'] = $this->numberInvit(); 
    $data['friends'] = $this->get_friends_unite(); 

    $this->form_validation->set_rules('texte_comment_unite','Commentaire','trim|required|xss_clean'); 

    if($this->form_validation->run()) 
    { 
     $texte_comment_unite = $this->input->post('texte_comment_unite'); 
     $id_space_unite = $this->input->post('id_news_u'); 
     $id_membre = $this->session->userdata('id_membre'); 
     $id_unite = $this->session->userdata('id_unite'); 

     $data = array(
      'texte_comment_unite'=>$this->input->post('texte_comment_unite'), 
      'id_space_unite'=>$this->input->post('id_news_u'), 
      'id_membre'=>$this->session->userdata('id_membre'), 
      'id_unite'=>$this->session->userdata('id_unite'), 
     ); 

     $this->unite_model->add_comment_unite_model($data); 

     redirect('unite/get_news_unite'); 
    } 
    else 
    { 
     $data['friends'] = $this->get_friends_unite(); 
     $data['users_online'] = $this->get_users_online(); 
     $data['uniteName'] = $this->uniteName(); 
     $data['numberInvit'] = $this->numberInvit(); 

     $layout_network['contenu'] = $this->load->view('espace_unite', $data, TRUE); 
     $this->load->view('layout_network',$layout_network); 
    } 
} ?> 

在我看來,當我提交表單,我調用這個函數。

謝謝

+0

顯示一些代碼可能幫助....幫助我們幫助你.. – Justin

回答

0

你試過這個嗎?

redirect('unite/get_news_unite', 'refresh');