2014-06-21 2 views
-1

jquery fancy box 팝업창을 사용하여 .... 팝업으로 ... 그러나 제출할 때 ... 리디렉션하는 양식 같은 창에서 ..... 팝업창에 ... 내 페이지를 열려있는 다른 창으로 리디렉션하고 싶습니다 .... 같은 팝업이 아님 ...jquery fancybox에서 리디렉션하는 방법 다음 페이지로 ... jquery에서

대상 빈을 사용했지만 모든 작업이 ... 클릭에 시간 ... 나는 내 로그인이 완료 왔을 때 .... 내가 CodeIgniter의 내 프로젝트를 만드는 해요 .....

내 컨트롤러 ....

public function login() 
    { 
     if ($this->input->post('action')) 
     {  
      $this->form_validation->set_rules('user_name', 'Username','required|valid_email'); 
      $this->form_validation->set_rules('password', 'Password', 'required|'); 


      if ($this->form_validation->run() == TRUE) 
      { 

       $username = $this->input->post('user_name'); 
       $password = $this->input->post('password');    
       $rember = ($this->input->post('remember')!="") ? TRUE : FALSE; 

       if($this->input->post('remember')=="Y") 
       { 
         set_cookie('userName',$this->input->post('user_name'), time()+60*60*24*30); 
         set_cookie('pwd',$this->input->post('password'), time()+60*60*24*30); 
        } 
        else 
        {      
         delete_cookie('userName'); 
         delete_cookie('pwd'); 
        }  

       $this->auth->verify_user($username,$password); 

       if($this->auth->is_user_logged_in()) 
       { 
         if($this->session->userdata('ref')!="" ) 
         { 

         redirect($this->session->userdata('ref'),''); 

         } 
         else 
         { 

         redirect('members/myaccount','refresh'); 

         } 


       } 
       else 
       { 

        $this->session->unset_userdata(array("ref"=>'0')); 
        $this->session->set_userdata(array('msg_type'=>'error')); 
        $this->session->set_flashdata('error',$this->config->item('login_invalid'));   
        redirect('users/login', ''); 
       } 

      } 
      else 
      { 
       $data['heading_title'] = "Login";   
       $this->load->view('users_login',$data); 
      }    
     } 
     else 
     { 
      $data['heading_title'] = "Login";   
      $this->load->view('users_login',$data);  
     } 
    } 
리디렉션 할 필요가
$(window).load(function (e) { 
    $("#back-top").hide(); 
    $(function() { 
     $(window).scroll(function() { 
      if ($(this).scrollTop() > 100) { 
       $('#back-top').fadeIn(); 
      } else { 
       $('#back-top').fadeOut(); 
      } 
     }) 
    }); 

    $(".login").fancybox({ 
     'width': 367, 
     'height': 600, 
     'autoScale': false, 
     'type': 'iframe' 
    }); 

    $(".fotget").fancybox({ 
     'width': 425, 
     'height': 286, 
     'autoScale': false, 
     'type': 'iframe' 
    }); 

    $(".profile").fancybox({ 
     'width': 700, 
     'height': 505, 
     'autoScale': false, 
     'type': 'iframe' 
    }); 

    $(".details").fancybox({ 
     'width': 400, 
     'height': 200, 
     'autoScale': false, 
     'type': 'iframe' 
    }); 

    $(".enquiry").fancybox({ 
     'width': 359, 
     'height': 450, 
     'autoScale': false, 
     'type': 'iframe' 
    }); 

    $(".contact").fancybox({ 
     'width': 317, 
     'height': 353, 
     'autoScale': false, 
     'type': 'iframe' 
    }); 

    $(".map").fancybox({ 
     'width': 425, 
     'height': 355, 
     'autoScale': false, 
     'type': 'iframe' 
    }); 
}); 

답변

0

팝업 내용이 iframe으로 인해 발생하는 이유는 ... 부모 창에 메시지를 보내어 기본 브라우저 창에서 리디렉션을 수행 할 수 있으며, iframe 통신의 상위 창 이 작업을 수행하는 데 필요한 정보를 얻으십시오. 그러나 iframe이 적용되는 페이지를 제어하는 ​​데있어 모든 힌트가 필요합니다.

예 : ... 당신의 리디렉션이 적 ...

window.onmesage = function(e){ 
    if(e.data == 'logged_in'){ 
    window.location.href = 'http://pathtopage'; 
    } 
} 
(... 하나는 fancyboxes을 intitializing) 부모 창에서 다음

echo "<script type=\"text/javascript\">window.top.postMessage('logged_in', '*');</script>"; 
exit; //make sure this is here, to stop php execution!! 

... 교체 곳

참고 : 단지

를 사용하는 'logged_in'는 또한 JSON 문자열을

'{ "action":"something","redirect":"http://url" }' 

이 될 수 json으로 개체를 추출하는 청취자의

JSON.parse(e.data); 

편집 : 잘 쓰레기 ... 나는 ... 귀하의 질문에 ... 난 당신이 양식을 제출하기 위해 사용하는 요소를 볼 수 없습니다 오해하지만, 일반적으로 e.preventDefault(); 그 요소를 리디렉션하기 전에 ... 요소를 사용하여 앵커 태그를 사용하고 있습니다. 예를 들어 앵커 태그를 사용하는 경우 ...