This is the only way I found to get all three browsers to submit the form without problems. Is there an obvious reason why this is so? A more elegant solution to this? I'm using jQuery 1.9. Chrome is the odd man out here, as the code in the else is sufficient to submit via IE and Firefox.
function submitFormByPost(actionName){
$("#eventAction").val(actionName);
var is_chrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1;
if(is_chrome){
document.getElementById('myForm').method='POST';
document.getElementById('myForm').submit();
}
else{
document.forms[0].method='POST';
document.forms[0].submit();
}
}
The way that works in Chrome will work in the others also, so just use that:
function submitFormByPost(actionName){
$("#eventAction").val(actionName);
var frm = document.getElementById('myForm');
frm.method = 'POST';
frm.submit();
}
Or using jQuery all the way:
function submitFormByPost(actionName){
$("#eventAction").val(actionName);
$('#myForm').attr('method', 'POST').submit();
}