AJAX has been watching, has been delaying, but still have to go all the way to be steadfast. In life everywhere is full of asynchronous era, do not learn how AJAX ...
First of all, explain the asynchronous: it is a means of communication, the two sides do not need a common clock, that is, the receiver does not know when the sender is sent, so in the message sent to prompt the receiver to start receiving information. Another implication is the asynchronous processing of computer multithreading. The standard communication interfaces provided by our PC are asynchronous. The next thing is better.
1 , AJAX What is it?
AJAX " asynchronous JavaScript and XML "(Async javascript xml " is a Web development technology that creates interactive Web applications. ajax enables Web pages to be updated asynchronously. This means that you can update a part of a webpage without reloading the entire page (when I learned the first three episodes I knew I could put it in a
The core of Ajax is the JavaScript object XMLHttpRequest. This object was first introduced in Internet Explorer 5, which is a technique that supports asynchronous requests. In short, XMLHttpRequest allows you to use JavaScript to make requests to the server and handle the response without blocking the user. It is JavaScript technology that talks to the server through the XMLHttpRequest object. This is not a generic application flow, which is exactly the source of the powerful features of Ajax.
2 , kind:
Remember that time I didn't learn ajax That's when I heard ajax very tall, that is the time to feel interest in this stuff, but also let us no longer unfamiliar.
(1) those who have Itoo I wrote them. AJAX :
<span style= "FONT-SIZE:14PX;" > $.ajax ({type: "POST", url: "/searchstudentinfo/addstudentreload", Data: "txtcandidateid=" + $ ("#txtCandidateID"). Val () + "&txtname=" + $ ("#txtName"). Val () + "&txtsex=" + $ ("#txtSex"). ComboBox (' GE Ttext ') + "&txtidentitycardid=" + $ ("#txtIdentityCardID"). Val () + "&txtcollege=" + $ ("#txtCollege"). com Bobox (' getText ') + "&txtdepartment=" + $ ("#txtDepartment"). ComboBox (' GetText ') + "&txtmajor=" + $ ("#Maj or "). ComboBox (' GetText ') +" &txtclass= "+ $ (" #Class "). ComboBox (' GetText ') +" &txtdormitory= "+ $ (" #txtD Ormitory "). ComboBox (' GetText ') +" &txtlevel= "+ $ (" #txtLevel "). ComboBox (' GetText '), Success:functi On () {$ ("#dg"). DataGrid ("Reload"); $.messager.alert ("Hint! "," the message was added successfully! "); $ (' #diaAdd '). Dialog (' Close '); }}) </span><span style= "FONT-SIZE:18PX;" ></span>
(2) Object-oriented type system
<span style= "FONT-SIZE:14PX;" ><script language= "javascript" type= "Text/javascript" >//Registry namespace Type.registerNamespace ("Asp Netajaxoverview "); Define a class Aspnetajaxoverview.person = function (FirstName, lastName) {this._firstname = FirstName ; This._lastname = LastName; }//Add Property Method AspNetAjaxOverView.Person.prototype = {Get_firstname:function () {return this._firstname; }, Get_lastname:function () {return this._lastname; }, Tostring:function () {return String.Format ("Hello, I ' m {0} {1}.", This.get_firstname (), This.get_lastname ()); }}//Register person Class AspNetAjaxOverView.Person.registerClass ("Aspnetajaxoverview.person"); AspnetajaxOverview.employee = function (FirstName, LastName, title) {//Initialize from parent class Aspnetajaxoverview.empl Oyee.initializebase (This, [FirstName, LastName]); This._title = title; }//Add properties and methods to the Employee class AspNetAjaxOverView.Employee.prototype = {get_title: function () {return this._title; },//method that overrides the parent class Tostring:function () {//Call the parent class method return A SpNetAjaxOverView.Employee.callBaseMethod (This, "toString") + "My title is '" + this.get_title () + "'."; }}//Register the Employee class and declare the inheritance from the person class AspNetAjaxOverView.Employee.registerClass ("Aspnetajaxove Rview.employee ", Aspnetajaxoverview.person); </script><input type= "button" value= "LIDA" onclick= "alert (New Aspnetajaxoverview.employee (' XU ', ' Dan ', ' Chair man ')); "/></span><span StYle= "FONT-SIZE:12PT;" ></span>
Ajax basically puts JavaScript technology and XMLHttpRequest objects between Web forms and servers . When a user fills out a form, the data is sent to some JavaScript code instead of being sent directly to the server. Instead, the JavaScript code captures the form data and sends the request to the server. Also, the form on the user's screen does not blink, disappear, or delay. In other words, the JavaScript code sends the request behind the scenes, and the user doesn't even know that the request was made. Better yet, the request is sent asynchronously, meaning that the JavaScript code (and the user) does not wait for the server to respond. So users can continue to enter data, scroll the screen, and use the application.
The server then returns the data to the JavaScript code (still in the Web form), which determines how the data is processed. It can quickly update form data, making it feel that the application is done immediately, that the form is not committed or refreshed, and that the user gets new data. JavaScript code can even perform some sort of calculation on the received data and send another request without user intervention at all! This is the strength of XMLHttpRequest. It can interact with the server as needed, and users can even be completely unaware of what is going on behind the scenes. The result is a dynamic, responsive, highly interactive experience similar to desktop applications, but with all the power of the internet behind it.
3. Summary
We know that the benefits of AJAX are reflected in the above, not allowing the page to be completely refreshed. You can refresh a small part of the page to reduce the amount of data transferred in the page. How much data to request. However , AJAX can also cause easy misuse, if a page is also able to do other operations, the user constantly request to refresh, so that the number of page requests server increase, will increase the burden on the service side, resulting in reduced response speed. Ajax is still in progress, allowing our pages to be more functional and the lightest burden ...
ajax--Overview