In my javascript file, I have a code snippet like:
$('<form action="process.php" method="POST">' +
'<input type="hidden" name="amp" value="' + calcJSON.totalAmpDay + '">' +
'<input type="hidden" name="watt" value="' + calcJSON.maxWattRate + '">' +
'<input type="hidden" name="dc_volt" value="' + document.number.dc_volt.value + '">' +
'</form>').submit();
The above code is included within a function definition. When I click a button, that function is called and then the browser should be redirected to “process.php” page with some POST data.
But only Chrome redirects me to a new page but Firefox wont.
How can this issue be resolved ?
Had this same problem about a week ago. I stand to be corrected but I believe in Firefox the form has to be added to the DOM before it can be submitted. I solved this by setting the CSS to “display: none” and added the form to an arbitrary element on the page before running the submit method.