A summary of how jquery implements form forms with Ajax

Source: Internet
Author: User
Tags trim

  This article is mainly on the implementation of the jquery Ajax form form of the method to summarize the introduction, the need for friends can come to the reference, I hope to help you.

Method A:      code as follows: function Addhandlingfeetorefund ()           {            var ajaxurl= ". /ordermanagement/ajaxmodifyorderservice.aspx ";                    alert ($ (' #formAddHandlingFee '). Serialize ());                 $.ajax {                & nbsp   Type: "POST",                     DataType: "html",                     Url:ajaxurl + '? action= ' + ' submithandlingfee ' + ' &ordernumber= ' + $.trim ($ ("#<%=this.txtordernumber.clientid%>"). Val ()), & nbsp                   data: $ (' #formAddHandlingFee '). Serialize (),     & nbsp               success:function (result) {      &NBSP                 var Strresult=result;                         alert (strresult);                        //load maximum amount of refund                         $ ("#spanMaxAmount"). HTML (strresult);                    },                     Error:function (data) {                        Alert ("Error:" +data.responsetext);                                   &N Bsp    });           {    method two: The code is as follows:        //ajax submit Form form         $ (' #formAddHandlingFee '). Submit (FuNction () {            var ajaxurl=. /ordermanagement/ajaxmodifyorderservice.aspx ";                    alert ($ (' #formAddHandlingFee '). Serialize ());                 $.ajax {                & nbsp   Type: "POST",                     DataType: "html",                     Url:ajaxurl + '? action= ' + ' submithandlingfee ' + ' &ordernumber= ' + $.trim ($ ("#<%=this.txtordernumber.clientid%>"). Val ()), & nbsp                   data: $ (' #formAddHandlingFee '). Serialize (),     & nbsp               success:function (data) {            &NBS P           var strresult=data;                        alert (strresult);                        //load maximum amount of refund                         $ ("#spanMaxAmount"). HTML (strresult);                    },                     Error:function (data) {                        Alert ("Error:" +data.responsetext);                                   &N Bsp    });        }     ( );     Page HTML code:   Code as follows:                   <form id= "Formaddhan Dlingfee "Name=" Formaddhandlingfee "enctype=" Multipart/form-data "onsubmit=" ADDHANDLINGFEEtorefund () ">                     <table id=" Addhandlingfee "class = "Wfill" >                         <tr>                             <td>                                 <asp:literal id= "Ui_amount" runat= "Server" text= "Processing fee" meta:resourcekey= "Handlingfeeamount"/>                 &N Bsp           </td>                     &NBSP ;       <td>                                 <input type= "text" id= "Txthandlingfeeamount" name= "Txthandlingfeeamount"  class= "{ Required:true,number:true} " Maxlength= "a"/>                             &L t;/td>                         </tr>     &N Bsp                   <tr>                             <td>                 &NBSP ;               <asp:literal id= "Ui_handlingfeetype" runat= "server" text= "cost type" meta: resourcekey= "Handlingfeehandlingfeetype"/>                     &NBSP ;       </td>                         &NBSP ;   <td>                                 <CRMweb:htmlselectcontrol id= "Handlingfeetype" Enumtypename= DX. OMS. Model.common.handlingfeetype,dx. OMS. Model.common "emptyvalue=" "emptytext=" select "runat=" Server "class=" text {required:true} "/>       & nbsp                     </td>           &NBSP ;             </tr>                   &NBSP ;     <tr>                             <td>                               &NBSP ; <asp:literal id= "ui_notes" runat= "Server" text= "Remarks" meta:resourcekey= "handlingfeenotes"/>       & nbsp                     </td>           &NBSP ;         &NBSP       <td>                                 <textarea id= "txtnotes" name= "txtnotes" class= "text {required:true}" cols= "" rows= "2" maxlengt H= "></textarea>                           &N Bsp </td>                         </tr>                           <tr>                             <td>             &NBSP ;               </td>                 &NBSP ;           <td>                                 <input id= "Submit1" type= "Submit" value= "Add processing fee"  />           &NB Sp                     <asp:button id= "Button1"  runat= "Server" Tex t= "Add processing fee" onclientclick= "Javascript:addhandlingfeetorefund ()"/>               & nbsp             </td>                   &NBSP ;       </tr>                     </table> &nbs P                   </form>    
Related Article

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.