0

I have some code that creates a form in memory and then submits it. For some reason it won't work on firefox. There are no errors on the console. Just nothing happens. Works on all other browsers.

Here's my code.

var myForm = document.createElement("form");
var inputs = '<input type="text" name="intWheelID" value="'+settings.wheelid+'" />';
    inputs += '<input type="text" name="Year" value="'+ intYear+'" />';
    inputs += '<input type="text" name="MakeID" value="' + intMake + '" />';
    inputs += '<input type="text" name="ModelID" value="' + intModel +'" />';
    inputs += '<input type="text" name="SubmodelID" value="' + strSubmodel + '" />'; 
    inputs += (color ? '<input type="text" name="colorID" value="' + color + '" />' : '');
    inputs += (vehicleid ? '<input type="text" name="VehicleID" value="'+ vehicleid + '" />': '');
    inputs += (settings.defaultsize ? '<input type="text" name="intSize" value="' + settings.defaultsize + '" />' : '');
    inputs += (settings.stag !== undefined ? '<input type="text" name="stag" value="' + settings.bolStag + '" />' : '');
$(myForm)
    .html(inputs)
    .attr("method","post")
    .attr("action", inpconfig_settings.destination)
    .attr("target","_blank")
    .submit();

The form has a target "_blank" because it has to submit to a different subdomain.

Jack Pilowsky
  • 2,275
  • 5
  • 28
  • 38
  • On some browsers it's sometimes necessary to append the form to the body before to submit it (last time I tried, a few years ago, I had the problem with IE...) – Denys Séguret Jan 15 '16 at 17:37
  • BTW you might be interested by this: https://stackoverflow.com/questions/17793183/how-to-replace-window-open-with-a-post – Denys Séguret Jan 15 '16 at 17:38

0 Answers0