目次 |
---|
・フォームデータをページを更新せず送信する ・サンプルソース ・実行例 |
<html> <head> <title></title> <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(){ $("#form1").submit(function(){ $.post( "postsample.php", $(this).serialize(), function(response){ alert(response); } ); return false; }); }); </script> </head> <body> <form id="form1"> 名前: <input type="text" name="name"><br> メッセージ: <input type="text" name="message"><br> <input type="submit" value="送信"> </form> </body> </html>