Forms-Asynchronous submission of forms provided by Form-easyui

Source: Internet
Author: User

    • Programme I

Form submitted

<formId="LoginForm"Method="POST">
<tablealign="Center">
<tr>
<thalign="Right"> User Name</th>
<td>
<inputType="Text"Name= "username" />
< /td>
</tr>
<tr>
<th align=" right "> password </TH>
<td>
<input type=name= "password" />
</td>
</tr>
</table>
</FORM>

Set up a form that needs to be submitted

$("#loginForm").Form ({
Url:"<%=Homepage%>/testcontroller/login.ajax?type=form ",
Successfunction (data) {
Console.Log (data);
data =Eval"(" +data+")"); //json String to Object
Console. log (data);
if ("0" = = Data.st) {
Console. log ("Success");
}else{
Console. log ("failed");
}
}
});

Where the commit action needs to be performed

$ ("#loginForm"). submit ();  

Background receives form parameters in the same way


data =JSON.  Parsejson (data);  JSON string Goto object   

This way can replace Evaljson.parsejson is the method of jquery, Eval is the method of JavaScript



    • Programme II

The first scenario is to set up the information submitted by the form externally, and then execute the commit action in the appropriate place.

Scenario two is to set up and submit in the same place, here's not a demo

In addition to setting the callback method for the success, you can also set the callback method of the onsubmit to perform some pre-commit checksum operations, and then stop the commit if False is returned.

These cases are relatively simple, do not be tired of

Form-Asynchronous submission of forms provided by Form-easyui

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.