手法1
<script>
$('#submitBtn').click(function(e) {
alert('押されたけどページの更新はしないよ。');
return e.preventDefault();
});
</script>
↑たったこれだけでOK
手法2
form タグに onsubmit=”doSomething();return false;” を追記するだけ。
<form id="fep-submission-form" method="post" onsubmit="doSomething();return false;">
下記のような書き方もある
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript">google.load("jquery", "1.3");</script>
<script type="text/javascript">
$(document).ready(function(){
$("#form00").submit(function(){
$.post( "postsample.php", $(this).serialize(), function(response){
alert(response);
} );
return false;
});
});
</script>
<form id="form00">
<input type="text" name="hogehoge">
<input type="submit" value="送信">
</form>