I have a python server that I wrote with custom do_GET method to parse form values.
My goal is to create a push button that I can put in a table which will inform the server if it hits and send a unique key that the server can parse. The button only needs to send pre-programmed keys to the server, so in reality the normal form values are not required which the user can input.
How did I search for this, and I got this example
I thought it would work well because I can make pushbutton using HTML which is my JS Ask to submit "form" to the server.
I did nothing and nothing happened, I looked at my Google Chrome console and I saw the following error: Unrecognized error: hierarchical error: DOM exception 3
Then I downloaded Firefox and firebug , And Firebug stepped up my code properly, but it was using my first time and I could ignore something
My target output received the server to receive this request Have to do
http://172.26.177.17/standardTable.html?TagID=00-00-11- AB-12 .. or another message with tag tags ID
My whole code is down, you probably have to take action, but everything else feels good to me.
& lt ;! DOCTYPE html & gt; & Lt; Html & gt; & Lt; Top & gt; & Lt; Title & gt; Test Form & lt; / Title & gt; & Lt; Script type = "text / javascript" & gt; Function vsform () {myform = document.createElement ('form'); Myform.method = 'get'; Myform.action = 'http: //172.26.177.17/standardTable.html'; Input 1 = document.createElement ('Input'); Input1.type = 'hidden'; Input1.name = 'tagID'; Input1.value = 00 '-00-11-AB-12'; Myform.appendChild (input 1); Document.appendChild (MyForm); Myform.submit (); } & Lt; / Script & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; Button type = "button" onclick = "createForm ()" & gt; Click me & lt; / Button & gt; & Lt; / Body & gt; & Lt; / Html & gt;
You are attached to the document, not the body. You want to add to the body:
myform.appendChild (input1); Document.body.appendChild (MyForm); Myform.submit ();
No comments:
Post a Comment