JSFiddle - React, Tailwind, and code Playground

JavaScript

//Sample data
var data = {
    field1 : 'Q@#*&^$@$)@^#$',
    field2 : 'value2',
};

//Create the form (style='display:none' isn't necessary - just use the hide() method)
var form = $('<form/>',{
    target: 'blank',
    action: '/someurl.do',
    method: 'post'
});

//Loop through data object
if (typeof data !== 'undefined') {
  for (var prop in data) {
      //Create a new <input/> element
      var input = $('<input/>',{
          type:'text',
          name: prop,
          value: data[prop]
      });
      //Append it to the form
      form.append(input);
  }
}

//Hide the form
//form.hide()

//Append the form to the body
$('body').append(form);

//Submit the form
//$(form).submit();