How to check if a form is submited via javascript?

Posted by SteD on Stack Overflow See other posts from Stack Overflow or by SteD
Published on 2010-05-23T11:51:27Z Indexed on 2010/05/23 12:00 UTC
Read the original article Hit count: 293

Filed under:
|
|

I have this conventional submit button which submit a form like this:

<form method="post" id="form_submit">
...
<input class="button" type="submit" name="Submit" value="Submit">
</form>

And I check if the submit button is clicked using this:

if(isset($_POST['Submit'])){
   //update DB
}

Now I have a submit link using jquery:

<a href="#" onclick="publish(); return false;">Submit</a>

JS code:

$("#form_submit").submit();

What is the alternative way here to be used here for if(isset($_POST['Submit'])) since I'm submitting the form using javascript?

© Stack Overflow or respective owner

Related posts about php

Related posts about jQuery