On the implementation of AJAX technology for pages without refreshing _ajax correlation

Source: Internet
Author: User

Ajax (Ajax development)

Ajax, "Asynchronous JavaScript and XML" (Asynchronous JavaScript and XML), refers to a web development technology that creates interactive Web applications.

AJAX = Asynchronous JavaScript and XML (a subset of standard generic markup languages).

AJAX is a technique for creating fast-moving web pages.

AJAX enables asynchronous updating of Web pages by making a small amount of data exchange in the background with the server. This means you can update portions of a Web page without reloading the entire page.

Traditional Web pages (without AJAX) if you need to update the content, you must overload the entire page page.

Now the general website is to use AJAX to achieve the page without refreshing operation.

What is no refresh: Ajax can realize the page and the background of the data interaction, the user completely feel no page has any refresh, this is Ajax no refresh.

Ajax method Implementations:

Ajax can be encapsulated to facilitate the invocation of each page:

function Myajax (type, URL, callBack, data, DataType, Asynctype)
{ 
if (DataType = null) {DataType = "text";} 
if (Asynctype = = null) {Asynctype = true;} 
$.ajax ({ 
type:type,//Post or get 
Url:url,//url preferably add a url+math.random (), which ensures that each requested page is considered different by the browser
data:data ,//Here is the parameter to pass, the format is data: "{paraname:paravalue}" 
Datatype:datatype,//string,xml,script,json,text
Async: Asynctype,//synchronous asynchronous True/false 
error:function (XMLHttpRequest, XMLHTTP, info) { 
}, 
success:function ( Result) { 
//callback function, result, return value 
callBack (Result), 
}, 
});

Call: Myajax (' post ', ' url?id= ' + ID, dook);

Description: Async:true represents asynchrony. This means that when the Ajax sends the request, the foreground will continue to execute the script behind the Ajax block as it waits for the server-side return, until the server side returns the correct result to execute the success, equivalent to two threads; false is synchronous, That is, the foreground waits until the server side returns data before executing.

About Ajax technology to achieve the page without refreshing effect, small set to introduce so many people, I hope to help you!

Related Article

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.