Let's take a look at this example. This has always been what I want to do.First, the following figure is displayed:Use northwind data. Click the plus sign to display the detailed orders of other products, and the number of orders for each product is
CopyCode The Code is as follows :/**
* pagination. js
* General Ajax-based paging class
* @ Author jeanwendy
* @ Version 1.0
*/
VaR paginationindex = 0;
VaR pagination = function (trtemplatid ){
$ (). Ajaxstart (function (){
$. Blockui ({
Message:
First, let's list the implementation of Ajax in jquery and prototype.
Jquery:
CopyCode The Code is as follows:
Prototype:Copy codeThe Code is as follows:
the prototype cannot be refreshed after the setinterval function is introduced. Why?
If Javascript is to be cross-origin, you can use:
you can read data from other websites.
The key is to see if your spirit is not flexible and you will use it.
To cross-origin Ajax, you can use the server to retrieve content from other websites,
Step 1 to solve the IE encoding problem:
Datatype :( $. browser. MSIE )? "Text": "XML" first, let ie identify whether text or XML is returned.
Step 2:
CopyCodeThe Code is as follows: function parsexml (XML) {// XML ie encoding Step 2
If (jquery.
The load () method is the simplest and most commonly used Ajax method in jquery. It can load remote htmlCodeAnd insert it to the Dom. Its syntax structure is:
Load (URL [, data] [, callback])
The parameters of the load () method are described in
Find by checking the source code
Copy codeThe Code is as follows: // Create the request object; Microsoft failed to properly
// Implement the XMLHttpRequest in IE7, so we use the ActiveXObject when it is available
// This function can be overriden
Start with a New Year's page. It is currently called grade.htm.
This file requires the introduction of two files: jquery. js (jquery framework file) and grade. js (verified individual files ).
The following input is used to enter the username. id = "
Index.html
Copy codeThe Code is as follows:
jQuery Ajax instance demonstration
input name:
enter the password:
ajax submit
post submission
get submit
Login. phpCopy codeThe Code is as follows: Echo json_encode (array
At the beginning, I learned JQuqery, and many $ get (),... and so on have already fainted me. Give up now.Later, I learned about ASP. net ajax. Under the leadership of Microsoft, I gradually switched from the server to the client programming.
After testing AJAX, it seems more concise than prototype. In JQuery, AJAX has three implementation methods: $. ajax (), $. post, $. get ().
XHTML (main ):
input name:
input age:
input Gender:
input job:
submit
POST
Traditional ajax Code
Copy codeThe Code is as follows:
JQuery MethodCodeCopy codeThe Code is as follows:
Get and postCodeCopy codeThe Code is as follows: get vs. POST enter name and birthday
Control ajaxCodeCopy codeThe Code is as follows: $.
The effect is as follows:
Copy codeThe Code is as follows:
Ajax Progress Bar
Ajax Progress Bar Example
Launch long-running process:
Copy codeThe Code is as follows: package cn. Ajax. test;Import java.
The request. jsp page contains rocarsId and ccrn text.
It corresponds to the msg_id and ccrn fields of the rocars table in the database. Now we need to modify the value of the ccrn on the interface. ajax is submitted to the response. jsp page, and
As follows:
Request. jsp
Copy codeThe Code is as follows: PageEncoding = "ISO-8859-1" %>
Insert title here
City Code: City Name:
Response. jspCopy codeThe Code is as follows: PageEncoding = "UTF-8" %>String code = request. getParameter
Request. jsp
Copy codeThe Code is as follows: PageEncoding = "ISO-8859-1" %>
Insert title here
RocarsId: 140 150 Show rocars ccrn messages.
Response. jspCopy codeThe Code is as follows: PageEncoding = "UTF-8" %> response the ccrn String q
Core ajax (options) functions include setting up xmlhttprequest, extracting data, and determining whether the response is successful. These functions basically meet daily requirements.
Copy codeThe Code is as follows: // A generic function for
In the B/S Development era, the front-end layout of web pages also absorbed the layout of Tab pages. In particular, the combination of Ajax technology can give full play to the advantages of the good performance of Tab pages and data cache. It is a
XMLHttpRequest provides the protocol for communication between the client and the http server.
I. Create
IE: http_request = new ActiveXObject ("Msxml2.XMLHTTP ");
Http_request = new ActiveXObject ("Microsoft. XMLHTTP ");
Non-IE: http_request = new
ASP. net ajax Framework
1. ValidatorCalloutIt is a member of ASP. net ajax Control Toolkit. The old bottled new wine provides a nice pop-up prompt effect for the validation Control of ASP. NET through extension. The disadvantage is that the
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