2016-07-28 7 views
0

편집 화면에서 저장 버튼에 식료품 crud에 대한 사용자 지정 리디렉션을 사용하려고합니다. 지금 리디렉션 URL의 끝에하면 window.location.hash를 추가 할 필요가식료품 점 javadript를 통한 Crud URL 리디렉션

$the_catalogue_id = $this->uri->segment(count($this->uri->segments));  
$this->grocery_crud->set_lang_string('update_success_message', 
      'Your data has been successfully stored into the database.<br/>Please wait while you are redirecting to the list page. 
      <script type="text/javascript"> 
       window.location = "'.base_url('catalogues/edit').'/'.$the_catalogue_id.'"; 
      </script> 
      <div style="display:none">' 
     ); 

,하지만 작동시킬 수없는 것 : 나는 성공적으로 아래의 예처럼 URL 조각을 사용하여 리디렉션 할 수 있습니다. 이것은 내가 지금까지 가지고있는 것입니다 :

$this->grocery_crud->set_lang_string('update_success_message', 
     'Your data has been successfully stored into the database.<br/>Please wait while you are redirecting to the list page. 
     <script type="text/javascript"> 
     var thehash = window.location.hash 
      window.location = "'.base_url('catalogues/edit').'/'.$the_catalogue_id.'"#"+thehash"; 
     </script> 
     <div style="display:none">' 
    ); 

어떻게 해시 변수를 리디렉션 URL 끝에 추가합니까?

답변

0

큰 따옴표를 "+thehash"에서 삭제하십시오.

연결 연산자와 변수는 생성 된 javascript에서 큰 따옴표로 묶어서는 안됩니다.

var thehash = window.location.hash; 
    window.location = "'.base_url('catalogues/edit').'/'.$the_catalogue_id.'#"+thehash; 
관련 문제