Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why can't I submit a dynamically created form in Firefox

I copied a part of a bigger project i'm working on, I didn't wrote the code so I hope someone could help me find out why sending a post request from js code with this fashion works in IE and doesn't in other browsers.

function f() {
    var container = document.createElement("form");
    container.method = "post";
    container.action= "http://localhost:3203/somefile.aspx";
    document.appendChild(container);
    container.submit();
}
like image 871
sekmet64 Avatar asked Jul 27 '10 13:07

sekmet64


1 Answers

Try document.body.appendChild(container) instead.

like image 171
kennytm Avatar answered Sep 22 '22 17:09

kennytm