2011-01-16 5 views
0

웹 사이트가 있으며 사용자가 지불 할 수 있고 웹에 3 개의 섹션으로 나뉘어있는 고유 한 페이지가 있어야합니다. 첫 번째는 지불 방법 (Visa, Mastercard, etc.)을 선택하기위한 것이며, 두 번째는 사용자가 전송할 금액을 입력하는 입력 상자와 Moneybookers 지불 게이트웨이의로드를 진행하는 버튼입니다. 세 번째 섹션에는 사용자가 트랜잭션 버튼을 클릭 할 때까지로드를 기다리는 빈 DIV가 있습니다. 일단 이것이 끝나면 AJAX를 통해 PHP를 호출합니다. AJAX와 함수의 코드는 다음 중 하나입니다 :Ajax 응답을 사용하여 DIV에 IFrame 삽입하기

var xml = null; 
    try{ 
     xml = new ActiveXObject("Microsoft.XMLHTTP"); 
    }catch(expeption){ 
     xml = new XMLHttpRequest(); 
    }xml.open("POST", "mb_connect.php", false); 
    xml.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); 
    xml.send("pay_to_email="+datos[3]+"&transaction_id="+datos[1]+ 
     "&status_url="+datos[2]+ 
     "&language="+lang+ 
     "&pay_from_email="+datos[13]+ 
     "&firstname="+datos[5]+ 
     "&lastname="+datos[6]+ 
     "&address="+datos[7]+ 
     "&postal_code="+datos[8]+ 
     "&city="+datos[9]+ 
     "&state="+datos[10]+ 
     "&country="+datos[11]+ 
     "&date_of_birth="+datos[12]+ 
     "&amount="+document.payment.cantidad.value+ 
     "&payment_methods="+datos[4]); 

    $("#contenido").html(xml.responseText); 

와라는 PHP입니다이 하나

<?php header('Content-type: text/html; Charset=utf-8'); 

extract($_POST); 
$status_url2 = 'mailto:[email protected]'; 
$return_url_target = 3; 
$return_url = 'https://www.misite.com'; 
$cancel_url = 'https://www.misite.com'; 

?> 


<iframe id="myiframe" name="myiframe" frameborder="no" style="height: 600px; width:735px;" scrolling = "auto"> 
</iframe> 
<form name="oc" action="https://www.moneybookers.com/app/payment.pl" method="post" target="myiframe"> 

<input type="hidden" name="pay_to_email"  value="<?= $pay_to_email ?>"> 
<input type="hidden" name="recipient_description" value="My SITE ltd"> 
<input type="hidden" name="transaction_id"  value="<?= $transaction_id ?>">  
<input type="hidden" name="status_url"  value="<?= $status_url ?>"> 
<input type="hidden" name="status_url2"  value="<?= $status_url2 ?>"> 
<input type="hidden" name="return_url_target" value="<?= $return_url_target ?>"> 
<input type="hidden" name="return_url"  value="<?= $return_url ?>"> 
<input type="hidden" name="cancel_url"  value="<?= $cancel_url ?>"> 
<input type="hidden" name="return_url_target" value="1"> 
<input type="hidden" name="cancel_url_target" value="1"> 
<input type="hidden" name="language"  value="<?= $language ?>"> 
<input type="hidden" name="confirmation_note" value=""> 
<input type="hidden" name="pay_from_email"  value="<?= $pay_from_email ?>"> 
<input type="hidden" name="title"  value=""> 
<input type="hidden" name="firstname"  value="<?= $firstname ?>"> 
<input type="hidden" name="lastname"  value="<?= $lastname ?>"> 
<input type="hidden" name="address"  value="<?= $address ?>"> 
<input type="hidden" name="postal_code"  value="<?= $postal_code ?>"> 
<input type="hidden" name="city"  value="<?= $city ?>"> 
<input type="hidden" name="state"  value="<?= $state ?>"> 
<input type="hidden" name="country"  value="<?= $country ?>"> 
<input type="hidden" name="date_of_birth"  value="<?= $date_of_birth ?>"> 
<input type="hidden" name="amount"  value="<?= $amount ?>"> 
<input type="hidden" name="currency"  value="EUR"> 
<input type="hidden" name="rec_cycle"  value="day"> 
<input type="hidden" name="payment_methods" value="<?= $payment_methods ?>"> 
<input type="hidden" name="submit_id"  value="Submit"> 

</form> 
<script language="JavaScript">document.oc.submit();</script> 

그래서,이 스크립트가 실행시 자동으로 카지노는 Moneybookers를 지불 게이트웨이를 호출하고를 반환 IFRAME에 삽입되는 HTML 코드.

글쎄,이 모든 과정은 Internet Explorer를 제외한 모든 브라우저에서 정상적으로 작동합니다. 오류가없고 DIV가 비어 있습니다.

실수 일 수있는 사람은 누구입니까?

어떤 도움을 주셔서 감사합니다.

감사합니다.

답변

0

원본 페이지가 moneybookers.com과 동일한 도메인에로드되어 있지 않으면 IE에서이를 보안 위반으로 간주합니다. 아마도 iFrame을로드 할 때 document.domain을 변경하면 문제가 완화 될 수 있습니다.

자세한 내용은 cross-domain communication with iFrames에 대한 좋은 기사입니다.

행운을 비네.

0

한 번이 문제가있었습니다. ajax가 요청한 페이지가 다른 도메인에 있기 때문에 POST 요청이 OPTION 요청으로 변경되어 문제가 발생했습니다. (그물 표만 확인하십시오.)

관련 문제