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
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