When we use Ajax, we usually need to get the form element value and then send it to the backend server-side program for processing. If the table cell is not much, we often get the form element value, but if the form element is very much, then need to use the Post method to get the form element value, then how to
Note:The $. Get () and $. Post () methods are global functions in jquery. The load () method mentioned above is used to operate jquery objects.
1. $. Get () method
The $. Get () method uses the get Method for asynchronous requ
-www-form-urlencoded;") of the XMLHttpRequest object.
Example:xmlhttp.setrequestheader ("Content-type", "application/x-www-form-urlencoded");
2. The parameter is a name/value one by one corresponding to the key value pairs, each pair of values separated by the number. like Var name=abcsex=manage=18, pay attention to Var name=update.php?
The abcsex=manage=18 and the Var name=?abcsex=manage=18 are all wrong;
3. Parameters sent in the Send (parameter) method, example: Xmlhttp.send (name); If i
The same logic code needs to be used in multiple sites, each site creates a new ashx is really a rip-off, so want to only request a ashx, so easy to maintain and modify, then, Ajax cross-domain problem comes.Less nonsense, directly on the code, what I'm doing now is GET request. The same is the POST request.First, the
This article describes how to use ajax paging in jQuery to implement code. If you are interested in ajax paging, refer to the example in this article and explain how to use ajax paging code in
-urlencoded;") of the XMLHttpRequest object. Cases:
Xmlhttp.setrequestheader ("Content-type", "application/x-www-form-urlencoded");2. The parameter is a name/value one by one corresponding to the key value pairs, each pair of values separated by the number. like Var name=abcsex=manage=18, pay attention to Var name=update.php?
The abcsex=manage=18 and the Var name=?abcsex=manage=18 are all wrong;3. Parameters sent in the Send (parameter) method, example: Xmlhttp.send (name); If it is a
When using jquery and ajax to write data, it is found that if the transmitted data contains , the data cannot be obtained and the + number is determined to be null. The solution is to use encodeURIComponent () the function encodes the data to be sent. When using jquery and ajax to write data, it is found that if the tr
XMLHttpRequest object. Cases:Xmlhttp.setrequestheader ("Content-type", "application/x-www-form-urlencoded");2. The parameter is a name/value one by one corresponding to the key value pairs, each pair of values separated by the number. like Var name=abcsex=manage=18, pay attention to Var name=update.php?The abcsex=manage=18 and the Var name=?abcsex=manage=18 are all wrong;3. Parameters sent in the Send (parameter) method, example: Xmlhttp.send (name); If it is a
Gets the JSON data from the background, populating the content into a drop-down list.URL: LinkPar:idSEL: drop-down list selector// get drop-down list function buildselectbox (URL, par, sel) { $ (SEL). empty (); function (JSON, textstatus) { for(var i = json.length-1; I >= 0; i--) { $ (SEL). Prepend (' ) }; $ (SEL). prepend (' ) });Very simple things, why on-line search is so complicated?
Today, to modify a bug, using AJAX query data, Google Browser can get the latest data, and in IE to get the old data, can not get the latest data, after the search data, only to discover when IE cache mischief.
Found this Ajax request using the
') {Defaults.url + = '? ' + encodeURI (param);}//2, ready to send (set parameters sent) Xhr.open (Defaults.type,defaults.url,defaults.async); Processing the POST request parameters and setting the request header information (must be set) var data = null; if (Defaults.type = = ' Post ') {data = param; Xhr.setrequestheader ("CoNtent-type "," application/x-www-form-urlencoded "); the request header, which must be added in//post mode, is the body part that tells the server how to parse the request.
1: GET access to the browser is considered to be idempotentIt means that the same URL has only one result. [the same means that the whole URL string is exactly matched]Therefore, if the URL string remains unchanged during the second visit, the browser directly obtains the result of the first visit.
POST is regarded as a variable access (the browser believes that the submission of POST must be changed)
To prevent idempotent
In asp.net, jquery ajax + WebService + json is used to implement the Code without refreshing the background value. This is better than page refreshing and provides a better user experience. For more information, see. First, paste Jquery's ajax:
The Code is as follows:
$.
This article mainly introduces jQuery's ajax-based code for voting a new bar chart with no need for animation effects. It is of great practical value to use jquery to dynamically operate the page element style attributes to achieve the bar chart voting effect, for more information about jQuery's ajax-based voting
jquery Ajax Application Instance code/*Ajax sends data to a page$.post (' save.cgi ', {Text: ' My string ',Number:23}, function () {Alert (' Your data has been saved. ');});
If you do need to write some complex Ajax scripts, you need to use the $.
There are not much work in the past two days, basically about ajax in jquery. Previously, it was always the simplest ajax request to write and did not focus on how to obtain the ajax return value. Jquery ajax is widely used to imp
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.