2012-07-12 5 views
-1

mysql 테이블의 데이터를 표시하는 테이블이있는 폼이 있습니다. 사용자 입력이 필요한 필드가 하나 있습니다. 각 행에는 div도 포함됩니다. 그런 다음 양식에 두 가지 기능이 있습니다.jquery 팝업 필드에 입력 필드 값을 보내십시오.

첫 번째 함수는 각 행의 입력 필드의 값을 처리하고

가 제 기능을 완벽하게 작동하는 결과의 형태로 행 DIV 그 결과를 전송하는 외부 PHP 페이지로부터의 정보를 표시하는 것 스크립트는 다음과 같습니다.

<script type="text/javascript"> 
     function get(row){  //row being processed, defined in onchange="get(x)" 
     $.post ('getpeopleinjobs.php',{  //data posted to external page 
     postvarposition: form["position"+row].value,  //variable equal to input box, sent to external page 
     postvarjob: form["job"+row].value,  //variable equal to input box, sent to external page 
     postvarperson: form["person"+row].value,  //variable equal to drop down list, sent to external page 
     postrow: row},  //variable equal row being processed, sent to external page 
      function(output){ 
       $('#training'+row).html(output).show();  //display external results in row div 
        }); 
       } 
</script> 

두 번째 기능은 제가 도움이 필요합니다. 거의 같은 자바 스크립트 함수를 다시 반복해야합니다. 그러나 행 변수를 외부 페이지로 보내는 대신 팝업 페이지로 보내려고합니다. 이 함수는 div에서을 (를) 클릭하면 트리거되어야합니다.

팝업을위한 javascript가 있습니다.

<script type="text/javascript"> 
    // Popup window code 
    function newPopup(url) { 
      popupWindow = window.open(  url,'popUpWindow','height=400,width=1000,left=10,top=10,resizable=yes,scrollbars=yes,toolbar=no,menubar=no,location=no,directories=no,status=yes') 
    } 
    </script> 

What I want to do is send the variables to the popup page, the same variables that were sent to the external page. 

so what I am aiming for is something like this: 

<script type="text/javascript"> 
// Popup window code 
function newPopup(url) { 

      function get(row){  //row being processed, defined in onchange="get(x)" 
     $.post ('trainingneeded.php',{  //my popup page 
     postvarposition: form["position"+row].value,  //these variables must be posted to the popup page 
     postvarjob: form["job"+row].value,  //these variables must be posted to the popup page 
     postvarperson: form["person"+row].value,  //these variables must be posted to the popup page 
     postrow: row},  //these variables must be posted to the popup page 
     ); 
     } 
    popupWindow = window.open(//open popup with the above variables posted to it 
     url,'popUpWindow','height=400,width=1000,left=10,top=10,resizable=yes,scrollbars=yes,toolbar=no,menubar=no,location=no,directories=no,status=yes') 
} 
</script> 

어떻게하면 좋을까요? href 가장 좋은 아이디어를 사용하고있다 또는 div에 onclick 이벤트가있을 수 있습니다.

미리 도움을 주셔서 감사합니다.

답변

1

는 아니, 팝업 창에 게시 할 수 없습니다. 당신은 url에 변수를 포함 할 수 있고 get으로 변수를 포함 할 수 있습니다.

또는 양식에 대상 = "_ 빈 '을 추가하고 그런 식으로 새 창을 열 수 있도록 할 수 있습니다.

그것은 팝업 창이되지 않습니다,하지만 요즘은 대부분의 사람들을 차단 또는 개방되는 브라우저 . 탭에서 해당 어쨌든, 그래서

또 다른 옵션은 빈에 팝업을 열 수 있습니다 중요하지 않을 수 있으며, 다음에 간단하게 write() 페이지 내용이 자바 스크립트를 사용

도 참조 :. asp.net/jQuery: post data with jQuery to a popup [IE]

관련 문제