Jquery Method for ajax form submission

Source: Internet
Author: User

Jquery Method for ajax form submission

This article mainly summarizes jquery's method for implementing ajax form submission. If you need it, you can refer to it and hope to help you.

Method 1:

 

The Code is as follows:

Function AddHandlingFeeToRefund ()

 

{

Var AjaxURL = "../OrderManagement/AjaxModifyOrderService. aspx ";

Alert ($ ('# formaddhandlinger'). serialize ());

$. Ajax ({

Type: "POST ",

DataType: "html ",

Url: AjaxURL + '? Action = '+ 'submithandlinger' +' & OrderNumber = '+ $. trim ($ ("# <% = this.txt OrderNumber. ClientID %>"). val ()),

Data: $ ('# formaddhandlinger'). serialize (),

Success: function (result ){

Var strresult = result;

Alert (strresult );

// Load the maximum refundable amount

$ ("# SpanMaxAmount" cmd.html (strresult );

},

Error: function (data ){

Alert ("error:" + data. responseText );

}

 

});

 

}

 

 

Method 2:

The Code is as follows:

// Ajax form submission method

$ ('# FormAddHandlingFee'). submit (function (){

Var AjaxURL = "../OrderManagement/AjaxModifyOrderService. aspx ";

Alert ($ ('# formaddhandlinger'). serialize ());

$. Ajax ({

Type: "POST ",

DataType: "html ",

Url: AjaxURL + '? Action = '+ 'submithandlinger' +' & OrderNumber = '+ $. trim ($ ("# <% = this.txt OrderNumber. ClientID %>"). val ()),

Data: $ ('# formaddhandlinger'). serialize (),

Success: function (data ){

Var strresult = data;

Alert (strresult );

// Load the maximum refundable amount

$ ("# SpanMaxAmount" cmd.html (strresult );

},

Error: function (data ){

Alert ("error:" + data. responseText );

}

 

});

}

 

);

 

 

Page html code:

The Code is as follows:

<Form id = "formaddhandling.pdf" name = "formaddhandling.pdf" enctype = "multipart/form-data" onsubmit = "AddHandlingFeeToRefund ()">

<Table id = "addhandling.pdf" class = "Wfill">

<Tr>

<Td>

<Asp: Literal ID = "UI_Amount" runat = "server" Text = "processing fee" meta: resourcekey = "HandlingFeeAmount"/>

</Td>

<Td>

<Input type = "text" id = "txtHandlingFeeAmount" name = "txtHandlingFeeAmount" class = "{required: true, number: true}" maxlength = "12"/>

</Td>

</Tr>

<Tr>

<Td>

<Asp: Literal ID = "UI_HandlingFeeType" runat = "server" Text = "billing 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>

</Tr>

<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 =" 22 "rows =" 2 "maxlength =" 100 "> </textarea>

</Td>

</Tr>

 

<Tr>

<Td>

</Td>

<Td>

<Input id = "Submit1" type = "submit" value = "add processing fee"/>

<Asp: Button ID = "Button1" runat = "server" Text = "add processing fee" OnClientClick = "javascript: AddHandlingFeeToRefund ()"/>

</Td>

 

</Tr>

</Table>

</Form>

 

 

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.