Form plug-in--form
Through form form plug-in, call ajaxForm() method, implement Ajax way to submit form data to the server, and through the options object in the method to get the server return data, the call format is as follows:
$(form). ajaxForm ({options})
Where the form parameter represents the form element name; Options is a configuration object that is used to send the AJAX request process to set the data and parameters to be sent.
1<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">234<title> forms plug-in </title>5<script type= "Text/javascript" src= "Http://www.imooc.com/data/jquery-1.8.2.min.js" ></script>6<script type= "Text/javascript" src= "Http://www.imooc.com/data/jquery.form.js" ></script>7<style>8 #divtest9 {Ten width:282px; One } A #divtest. Title - { - padding:8px; thebackground-Color:blue; - color: #fff; - height:23px; -line-height:23px; +font-size:15px; -font-Weight:bold; + } A #divtest. Content at { - padding:8px 0px; -background-color: #fff; -font-size:13px; - } - #divtest. Content. Tip in { -text-Align:center; to border:solid 1px #ccc; +background-color: #eee; - margin:20px 0px; the padding:8px; * } $ . FLPanax Notoginseng { - float: Left; the } + . Fr A { the float: Right; + } -</style> $ $ -<body> -<form id= "FRMV" method= "Post" action= "#" > the<div id= "Divtest" > -<div class= "title" >Wuyi<span class= "FL" > Personal Information page </span> the<span class= "FR" > -<input id= "btnsubmit" type= "Submit" value= "Commit"/> Wu</span> -</div> About<div class= "Content" > $<span class= "FL" > User name: </span><br/> -<input id= "user" name= "user" type= "text"/><br/> -<span class= "FL" > Nickname: </span><br/> -<input id= "Nick" Name= "Nick" type= "text"/> A<div class= "Tip" ></div> +</div> the</div> -</form> $ the<script type= "Text/javascript" > the$(function () { the varOptions = { theURL: "9-2.php", -Target: ". Tip" in } the$ ("#frmV"). Ajaxform (options); the }); About</script> the</body> theView Code1 <? PHP 2 $user = $_post[' user ']; 3 $nick = $_post[' Nick ']; 4 echo "User name:" $user. " Nickname: ". $nick;
View CodeForm plug-in--form