jquery Ajax Submission Form (file && input)

Source: Internet
Author: User
Tags yii

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" &GT;QQ No. </label> <input type= "text" id= "QQ" Name= "QQ" placeholder= "Please enter QQ number" > &lt ;/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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.