Reputation: 5367
The following JQuery (v1.10.2) works well in Chrome (35.0.1916.153)
$('<form action="dashboard" method="POST">
<input type="hidden" name="dashboard_id" value="1002"/>
</form>').submit()
..the form is submitted, and the browser navigates to the 'action' uri.
However, in Firefox (28) and IE, it does not have the same behaviour. Rather than submitting the form and navigating away, a Javascript object is just returned from the call.
Can someone tell me why the browser doesn't behave as though the form was submitted in FF and IE?
Upvotes: 0
Views: 101
Reputation: 1312
If FF and IE form created not as DOM object. Use this code for creating form and submit.
$('body').append('<form action="dashboard" id="tempform" method="POST"><input type="hidden" name="dashboard_id" value="1002"/></form>');$('#tempform').submit()
Upvotes: 2
Reputation: 130
I think instead of create a form by HTML code and run submit() you should try on $.post
$.post("dashboard", {dashboard_id: 1002}, function( data ) {
// Do something with response
});
Upvotes: 1