Javascript code doesn't belong in the action
attribute. You can use the onsubmit
event.
<form onsubmit="return false;" .... >
note however that it's considered good style to specify an action
that will work if the user has JavaScript turned off (graceful degradation). If you don't specify an action
property, the form will be submitted to the current page URL.
@Justin correctly notes that having JavaScript code in the HTML markup is strictly speaking always a bit dirty. The good practice would be giving the form an id
attribute, and assigning the JavaScript code to that element in the head
part.
With pure Javascript:
document.onload = function() {
document.getElementById("formid").onload = function() { ..... }
}
With jQuery
$(document).ready(function() {
$("#formid").load(function() { .... });
});