Note that there are some explanatory texts on larger screens.

plurals
  1. POAJAX sends all fields in the form
    primarykey
    data
    text
    <p>I have a HTML file that calls a CGI script. When I click logout button, POST method sends all the fields. Is this a known bug?</p> <p>Here is my Javascript code:</p> <pre><code>var request = null, session = null; function postEscape(val) { return encodeURIComponent(val).replace(/%20/g, "+") } function submit_logout() { var request=null if( !document.form.loggedIn.checked ) return logout = new XMLHttpRequest() logout.open("POST", "client.cgi", true /* asynchronous? */ ) logout.setRequestHeader("Content-Type", "application/x-www-form-urlencoded") console.log("action=logout&amp;session=" + postEscape(document.form.session.value)+"&amp;host="+postEscape(document.form.host.value)+"&amp;port="+postEscape(document.form.port.value)) logout.send("action=logout&amp;session=" + postEscape(document.form.session.value)+"&amp;host="+postEscape(document.form.host.value)+"&amp;port="+postEscape(document.form.port.value)+"&amp;action=logout") form.loggedIn.checked = false } </code></pre> <p>This is what I see in POST data:</p> <p>username=&amp;password=&amp;host=somehost.com&amp;port=6700&amp;action=logout&amp;display=++++&amp;session=</p> <p>and here is my form</p> <pre><code>&lt;body&gt; &lt;form name = "form"&gt; &lt;input name="username" size="25" type="text"&gt;username&lt;br&gt; &lt;input name="password" size="25" type="text"&gt;password&lt;br&gt; &lt;input name="host" size="25" type="text"&gt;host&lt;br&gt; &lt;input name="port" size="25" type="text"&gt;port&lt;br&gt; &lt;input name="login" value="Login" type="button" onclick="submit_login()"&gt;&lt;input type="checkbox" name="loggedIn" id = "loggedIn" onclick="this.checked=!this.checked"&gt; &lt;input name="action" value="logout" type="submit" onClick="submit_logout()"&gt;&lt;br&gt; &lt;textarea name="display" rows="24" cols="68"&gt; &lt;/textarea&gt;&lt;br&gt; &lt;input type="hidden" name="session" value=""&gt; &lt;input name="message" size="64" maxlength="64" type="text"&gt;&lt;input name="send" value="send" type="button" onClick = "send()"&gt;&lt;p&gt;&lt;/p&gt; &lt;/form&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload