From: http://www.cnblogs.com/lmfeng/archive/2011/06/18/2084325.html
Let me start by explaining that this is the use of ASP.
jquery to submit to form form, here is a form form, there is no action field, we can register the event with jquery to submit,
<form method= "POST" id= "DocumentForm" >
<input type= "hidden" id= "Hidid" name= "Hidid" value= "<%=request.querystring[" id "]%>"/>
<input type= "hidden" id= "hidaction" name= "hidaction" value= "<%=request.querystring[" action "]%>"/>
<div class= "Fieldbody" >
<div class= "Tagsiglebody" >
<table class= "Create" >
<tr>
<th class= "W100" >
Key words:
</th>
<TD class= "NES" >
<input type= "text" id= "Txtkeyword" name= "Txtkeyword" class= "txt w250" value= "<%= viewdata.eval (" keywords ")%> "
Isnull= "0"/>
Please separate the keywords with commas
</td>
</tr>
</table>
</div>
</div>
<div class= "Btngroup" >
<input type= "button" class= "Btncreateok" id= "btnconfirm" value= "create"/>
<input type= "button" class= "Btncreatecancel" onclick= "History.go ( -1)" value= "Cancel"/>
</div>
</form>
The code in JS is as follows:
$ (document). Ready (function () {
$ ("#btnConfirm"). Click (function () {
$ (' #documentForm '). SubmitForm ({
URL: "/document/submitdocumentcreate",
DataType: "Text",
Callback:function (data) {
Endfileupload ();
data = eval ("(" + Data + ")");
Alert (data. Content);
if (data. Result > 0) {
Location.href = data. Redirect;
}
},
Before:function () {
Startfileupload ();
var errmsg = "";
}
}). Submit ();
});
}
In JS, we must note that $ (document). Ready is required, otherwise it will be an error, with the event binding of the button, the ID of the form: $ ("#btnConfirm"). Click, $ (' #documentForm '). SubmitForm
The URL and callback method are then given in the $ (' #documentForm '). SubmitForm method.
Well, this is done, of course, how to get the value of the form in Document/submitdocumentcreate, with request.form["xxxxx", you can get the value of the form.
jquery to submit to form form (MVC scheme)