I am trying to submit form by calling a function . Here is my code . When I call it it's not redirecting. Thanks in advance.
submitData();
function submitData(){
let formHTML = '\'<html>\n' +
' <head></head>\n' +
' \n' +
' <body onload="document.forms[0].submit()" style="display: none;">\n' +
' <form name="subData" method="POST" action="www.google.com">\n' +
' <input type="text" name="email" value="xyz@gmail.com">\n' +
' <input type="text" name="phone" value="121212221">\n' +
' <input type="text" name="message" value="Success">\n' +
' </form>\n' +
' </body>\n' +
'</html>\';';
}