Reputation: 520
I am using this simple way to submit a form in a pop up window (which need to be done with vanilla JS)
<form onsubmit="CheckoutProducts.onSubmitForm(this);" action="/product/"
method="post" name="paymentForm" id="paymentForm">
and this is my JS code
var CheckoutProducts = CheckoutProducts || {
onSubmitForm: function(form) {
window.open('', 'formpopup','width=400,height=400,resizeable,scrollbars');
form.target = 'formpopup';
document.paymentForm.submit();
}
}
It is working fine in Chrome, but for some reason it is not working in Firefox and IE, it just opens the pop up with the blank page, What am I doing wrong?
Upvotes: 2
Views: 920
Reputation: 20058
Very simple would be to use tested component that works in all major browsers in the same way.
$( "#dialog" ).dialog({ autoOpen: false });
$( "#opener" ).click(function() {
$( "#dialog" ).dialog( "open" );
});
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
<button id="opener">open the dialog</button>
<div id="dialog" title="Dialog Title">I'm a dialog</div>
Upvotes: 1