javascript - form.submit() not working in firefox -


i using following javascript function construct form , submitting server. works fine in chrome browser not working in firefox.

function loadpage(url, projectname){     var jform = $('<form></form>');     jform.attr('action', url);     jform.attr('method', 'post');      var jinput = $("<input>");     jinput.attr('name', 'curprj');     jinput.attr('value', projectname);     jform.append(jinput);      jform.submit(); } 

i got suggestion se's older post mozilla form.submit() not working, append form document body document.body.appendchild(jform) unfortunately didn't work me either. got following error in debug console when used document.body.appendchild(jform) before form submit.

typeerror: argument 1 of node.appendchild not implement interface node. @ http://localhost:9000/assets/javascripts/global.js 

am missing here? pls advise.

document.body.appendchild(jform) won't work because jform not dom element, jquery object add below script before jform.submit();

jform.appendto('body') 

function loadpage(url, projectname) {     var jform = $('<form></form>', {         action: url,         method: 'post'     });      $("<input>", {         name: 'curprj',         value: projectname     }).appendto(jform);      jform.appendto('body').submit(); } 

Comments

Popular posts from this blog

javascript - Unusual behaviour when drawing lots of images onto a large canvas -

how can i manage url using .htaccess in php? -

javascript - Chart.js - setting tooltip z-index -