Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Your code should work, I have created an example for you to test, here it is: <a href="http://jsfiddle.net/afzaal_ahmad_zeeshan/yFWzE/" rel="nofollow">http://jsfiddle.net/afzaal_ahmad_zeeshan/yFWzE/</a></p> <pre><code>&lt;form id="form"&gt; &lt;input type="text" name="something" id="something" /&gt; &lt;/form&gt; &lt;a href="#" onclick="document.getElementById('form').submit();"&gt;Submit&lt;/a&gt; </code></pre> <p>By using this you will submit the form using the id of it. And other user told you to use jQuery, which I am afraid you don't want to. In jQuery you use <code>.preventDefault</code> but if you want to stick to the simple JS then you will be using <code>href="#"</code> which will automatically prevent any anchor tag execution. </p> <p>And the result of the request can be checked, which sadly is an error. But it makes sure that the request has been sent to the server.</p> <p>Then you can test the methods and other type of executions by having some <code>if else</code> blocks as</p> <pre><code>if(condition == true) { // if post } else { // if get } </code></pre> <p>The parameter might be mis handled on the server side, because when the form is submitted you need to take out the data from the QueryString (the request is GET). So, you need to check that, or if that's not the issue then make sure you're pointing the element well. Otherwise if there is no such element, nothing will be sent.</p> <p>I am not sure, which language you're using but here is the code for ASP.NET</p> <pre><code>var value = Request.QueryString["something"]; </code></pre> <p>PHP version is already present above. That all depends on the parameters you send with the request. You are more likely to convert the code to a function. Such as</p> <pre><code>&lt;a href="#" onclick="submit()"&gt;Submit&lt;/a&gt; </code></pre> <p>And the function</p> <pre><code>function submit() { // create variable var value = document.getElementById("something").value;\ // now submit the form and all that other bla bla, which // you want to be process, } </code></pre> <p>If you find this one tricky, using jQuery as</p> <pre><code>var values = $('form').serialize(); </code></pre> <p>will be easy. This will create a string of the form and will send it with the request.</p>
    singulars
    1. This table or related slice is empty.
    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.
    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