jquery Ajax the two methods for submitting form forms are summarized (recommended) _jquery

Source: Internet
Author: User

jquery Ajax to submit form form of two methods summary (recommended)

Method One:

function Addhandlingfeetorefund ()

    {
      var ajaxurl= ... /ordermanagement/ajaxmodifyorderservice.aspx ";    
      Alert ($ (' #formAddHandlingFee '). Serialize ());
        $.ajax ({
          type: POST),
          dataType: "html",
          Url:ajaxurl + '? action= ' + ' submithandlingfee ' + ' &ordernumber= ' + $.trim ($ ("#<%=this.txtordernumber.clientid%>"). Val ()), C10/>data: $ (' #formAddHandlingFee '). Serialize (),
          success:function (result) {
            var strresult=result;
            alert (strresult);
            Load maximum fallback amount
            $ ("#spanMaxAmount"). HTML (strresult);
          },
          error:function (data) {
            alert ("Error:" + Data.responsetext);}}

    

Method Two:

    How Ajax submits form forms
    $ (' #formAddHandlingFee '). Submit (function () {
      var ajaxurl= ... /ordermanagement/ajaxmodifyorderservice.aspx ";    
      Alert ($ (' #formAddHandlingFee '). Serialize ());
        $.ajax ({
          type: POST),
          dataType: "html",
          Url:ajaxurl + '? action= ' + ' submithandlingfee ' + ' &ordernumber= ' + $.trim ($ ("#<%=this.txtordernumber.clientid%>"). Val ()),
          Data: $ (' #formAddHandlingFee '). Serialize (),
          success:function (data) {
            var strresult=data;
            alert (strresult);
            Load maximum fallback amount
            $ ("#spanMaxAmount"). HTML (strresult);
          },
          error:function (data) {
            alert ("Error:" + Data.responsetext);}};

  

Page HTML code:

<form id= "Formaddhandlingfee" name= "Formaddhandlingfee" enctype= "Multipart/form-data" Addhandlingfeetorefund () "> <table id=" addhandlingfee "class=" Wfill "> <tr> <td> <as P:literal id= "Ui_amount" runat= "Server" text= "processing costs" meta:resourcekey= "Handlingfeeamount"/> </td> <t d> <input type= "text" id= "Txthandlingfeeamount" name= "Txthandlingfeeamount" class= "{required:true,number:true } "maxlength="/> </td> </tr> <tr> <td> <asp:literal id= "Ui_handli 
       Ngfeetype "runat=" server "text=" fee type meta:resourcekey= "Handlingfeehandlingfeetype"/> </td> <td> <crmweb:htmlselectcontrol id= "Handlingfeetype" Enumtypename= DX. OMS. Model.common.handlingfeetype,dx. OMS. Model.common "emptyvalue=" "emptytext=" select "runat=" Server "class=" text {required:true} "/> </td> </t r> <tr> <td> <asp:liTeral id= "ui_notes" runat= "Server" text= "Remarks" meta:resourcekey= "handlingfeenotes"/> </td> <td> <textarea id= "txtnotes" name= "txtnotes" class= "text {required:true}" cols= "rows=" "2" maxlength= "The ></te" xtarea> </td> </tr> <tr> <td> </td> <td> <i Nput id= "Submit1" type= "Submit" value= "Add processing fee"/> <asp:button "id= Button1" runat= "Server" text= "Add processing fee" Onclien Tclick= "Javascript:addhandlingfeetorefund ()"/> </td> </tr> </table> </form>

Above this jquery Ajax to submit form form of two methods summary (recommended) is small to share all the content of everyone, hope to give you a reference, but also hope that we support cloud habitat community.

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.