I am trying to modally open an external url. This external location enables the user to input a payment. After the user has sucessfully paid, the user should be directed back to the site that I am working on. In order to accomplish this, I am currently styling an iframe as a modal window. When the user clicks the 'next' button, a form action posts the external url to my iframe. Then, the css creates a modal-like effect in order to prevent the user from clicking buttons on the previous screen until the payment is input. The external url requires a return url and a cancel url as input parameters. When the user is done with the website, they will click either submit or cancel and the external site will navigate the user to the appropriate location. The problem that I am having is when the user clicks cancel or submit on the external site, the modal window remains open and navigates to the new location. What I want to happen is for the modal window to close and for the user to be navigated to the necessary url in the main browser. Does anyone have an idea for how to accomplish this or a method of coding this that would avoid this problem? Thanks!
Code:
<style>
.modalDialog {
position: fixed;
font-family: Arial, Helvetica, sans-serif;
top: -60;
right: 0;
bottom: 0;
left: 0;
background: #EAC5C5;
z-index: 99999;
opacity:0;
-webkit-transition: opacity 400ms ease-in;
-moz-transition: opacity 400ms ease-in;
transition: opacity 400ms ease-in;
pointer-events: none;
}
.modalDialog:target {
opacity:1;
pointer-events: auto;
}
.modalDialog > div {
width: 850px;
height: 700px;
position: relative;
margin: 10% auto;
padding: 5px 20px 13px 20px;
background: #fff;
}
.close {
background: #606061;
color: #FFFFFF;
line-height: 25px;
position: absolute;
right: -12px;
text-align: center;
top: -10px;
width: 24px;
text-decoration: none;
font-weight: bold;
-webkit-border-radius: 12px;
-moz-border-radius: 12px;
border-radius: 12px;
-moz-box-shadow: 1px 1px 3px #000;
-webkit-box-shadow: 1px 1px 3px #000;
box-shadow: 1px 1px 3px #000;
}
.close:hover { background: #00d9ff; }
</style>
<script type="text/javascript">
function openModal() {
window.location.assign("#openModal")
}
function cancelUrl() {
window.location.assign("#close")
}
</script>
<body>
<form action="https://hostedpage" target="my-iframe" method="post" id="testForm" runat="server">
<label for "Hidden4">Amount: </label>
<input type="text" name="Amount" id="Hidden4" value="" />
<input type="hidden" name="RURL" id="Hidden7" value="https://testurl.com" />
<input type="hidden" name="CURL" id="Hidden8" value="http://testurl2.aspx#close" />
<asp:Button ID="Submit" runat="server" Text="Next" UseSubmitBehavior="true" OnClientClick="openModal()" />
</form>
<div id="openModal" class="modalDialog" >
<div id="div1">
<a href="#close" title="Close" class="close">X</a>
<iframe id="iframe" name="my-iframe" style="width: 850px; height: 700px;" frameborder="0" ></iframe>
</div>
</div>
</body>