Plug-ins to use
Jquery.js
Jquery.form.js[http://malsup.github.io/jquery.form.js]
Submit Page
<form enctype= "Multipart/form-data" id= "Onlineservice_leave_message_form" > <divclass= "CLS" > <label for= "Mail" > <spanclass= "Require" >*</span> e-mail </label> <input type= "text" id= "Mail" name= "Mail" placeholder= "recommended stay Under your QQ mailbox "value=" <?php if (! Yii::app ()->user->isguest && Yii::app ()->user->name) {echo yii::app ()->user->name;}? > "> </div> <divclass= "CLS" > <label for= "QQ" >QQ No. </label> <input type= "text" id= "QQ" Name= "QQ" placeholder= "Please enter QQ number" > < ;/div> <divclass= "CLS" > <label for= "Tel" > Contact phone </label> <input type= "Text" id= "Tel" name= "tel" placeholder= "Please enter your contact number" > </div> <divclass= "CLS" > <label for= "question" > <spanclass= "Require" >*</span> problem description </label> <textarea name= "question" id= "question" style= "width:317p x;height:114px;max-width:329px; " ></textarea> </div> <divclass= "CLS" > <label for= "File" > Add attachment </label> <input type= "file" name= "file" id= "file" > </div> <divclass= "Checkcode cls" > <label for= "Code" > Verification Code </label> <input type= "text" id= "code" name= "code" > <?PHP$this->widget (' Commonurlcaptcha ',Array( ' Showrefreshbutton ' =true, ' clickableimage ' =true, ' buttonlabel ' = ' Change One ', ' imageoptions ' =Array( ' Alt ' = ' Click to change ', ' title ' + ' Click to change ', ' id ' = ' img_captcha ', ' Style ' = ' cursor:pointer ', ' backColor ' = ' #000 ', ' width ' =&G T , ' height ' = 30, ) )); ?> </div> <divclass= "CLS" > <label for= "" ></label> <input type= "button" value= "Submit"class= "Btn-guest" id= "Onlineservice_leave_message_submit" > </div> </form>
Js
<script type= "Text/javascript" charset= "Utf-8" src= "/js/chat_version2/jquery.form.js" ></script>< Script type= "Text/javascript" charset= "Utf-8" >$ (document). Ready (function(){ varoptions={URL: "Onlineservice/onlineserviceleavemessage",type: "Post",Success:function(MES) {alert (MES); } }; $("#onlineservice_leave_message_form"). Submit (function() {$ (this).ajaxsubmit (options); return false; }); $("#onlineservice_leave_message_submit"). Click (function(){ $("#onlineservice_leave_message_form").submit (); }); });</script>
Jquery.form.js Main method Description, reference
Http://www.open-open.com/lib/view/open1325032463827.html
jquery Ajax Submission Form (file && input)