1. Use $ ("form"). Serialize () to get form data$.ajax ({ 'post', 'your URL' ) , data: $ ("form"). Serialize (), success:function (data ) { // your code }});2. Using the Jquery.form.js plugin$ ('#fm'). Form ('submit', { url:url, onSubmit
the first method (easy to use, anti-mosquito):1.1 Receive from Form form to Congtroller. 1 is the form form, 2 is the AJAX submission 3 SPRINGMVC receive1.2 Debug look backstage data, see, Usereo received the data1.3 People want to see Seralize and Seralizearray data differe
(' select_tr ');
});
$ ("#bindShipmmsiDiv table tbody tr"). DblClick (function () {
Fillshipmmsiandname (this);
$ ("#bindShipmmsiDiv"). Hide ();
});
}
}
}
});
3, through jquery $ ("form"). Serialize () Can serialize data from form forms to the background, so you can manipulate form forms and process the returned data through
1. Problem background
Now, more and more people are trying to use Ajax-based Web development. in the. Net environment, Ajax is not very convenient, which may be caused by the following reasons:
• Because Ajax is based on the nature of javascript, developers must have a good understanding of javascript. At least, its javascript capability is sufficient to update p
This is the simplest.
The code is as follows
Copy Code
$.post ("/index.php?action=ajaxrs=twproajax::checkprotermsexisted", $ (this). Serialize (), function (data) {}, ' json ');
Note that serialize is submitting all your form input in post form or get form, and look at the example below
We have a very common
= "BTN"type= "button"value= "POST" /> TD> TR> tbody> Table> form> P>---------------------Comments List-----------------------P> ulID= "ul"> ul> Body>JS Code:Note: The problem resolution: through the form, the request message serialization (two methods, whichever is OK!) ) into a set or id=valuename=value This formYou don't have t
it into the HTML page.ajax.beginform (): It renders as an HTML form form, similar to Html.BeginForm (). When it commits, it gets the new content and inserts it into the HTML page.Ajax.routelink (): Ajax.routelink () is similar to Ajax.actionlink (). However, it can generate a URL based on any of the routing parameters, without having to include the invoked action. The most used scene is a custom icontrolle
buttons, the same page, but also need to display different data, here due to the page caching problems, resulting in the page each time the display of the same data.That's not what we want. This requires clear form data.As follows:$ (' #myform ') [0].reset ();Attention!!!!!!! This method has tried not to, the following method is reliable!!$ (': input ', ' #form表单的id '). Not (': button,: Submit,: RESET,: Hid
Uploading Files using form formKnowledge points/attention pointsFrom the form to add this line enctype="multipart/form-data" upload file upload is binary data with request. FILES got a dictionary, too.Front-end Code index.html"en">"UTF-8"> "/index/"Method="Post"Enctype="Multipart/form-data"> "text"Name="User">"file"Nam
$.ajax({cache:true,type:"POST",url:ajaxCallUrl,data:$(‘#yourformid‘).serialize(),//你的formidasync:false,error:function(request){alert("Connectionerror");},success:function(data){$("#commonLayout_appcreshi").parent().html(data);}});How Ajax (or jquery) submits the entire form form
, such as, the site has a new order, please log on to the site timely processing. ShowMsg (' Before sending ', ' javascript:; '); if (! $mail->send ()) {//echo "Fail to send."; ShowMsg (' Send failed ', ' javascript:; '); /showmsg (' send failed '); exit;} ShowMsg (' Send success ', ' javascript:; '); /echo "Mail sent successfully"; Dede can use ShowMsg (' send success ') to test whether to send a successful}}/*end send message */if ($dsql->executenonequery ($query)) {$id = $ Dsql->ge
There are many ways to implement Ajax in MVC. Microsoft's microsoftajax can also be implemented using jquery's Ajax. If you are familiar with other JavaScript frameworks, you can also use other implementation schemes, such as prototype.
The following are Microsoft's own implementation solutions.
JavaScript files to be preloaded:
Script SRC =" @ UR
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.