There are two types of mistake in this code.
The first problem: you
use different values of
id
in the form and the script. If you want to add an event to a form shown in the HTML code, use the
id = "myform"
in both places, that is, change first descriptor:
$("#myform").submit(function(){ });
The second problem is: the each of the lines "
return false;
"
blocks further event processing. Let's see what happens if you remove both return statements. First, the button
click
handle is executed; on the second step, the form handler
submit
is executed, and on the third step, the post goes.
If you use your return statement in the
submit
handler, the post execution is blocked, you will have only the
click
handler followed by the
submit
handler. If you use this return statement in the
click
handler, it will be executed, but the
submit
handler and post will be blocked.
[EDIT]
Probably you still need to use the return statement, but conditionally; for example, depending on the filtering results or any other conditions, such as the result of data validation.
[END EDIT]
I tested this code before posting this answer: changing the
id
value in the selector and commenting out of the return statements makes both handlers and the post executing.
—SA