I recently encountered the problem of passing Chinese parameters. Search online, copy, paste, and publish the "ultimate" solution "is nothing more than escape (STR) for transcoding, and then write a method on the server to edit it again, or use
The property method can contain parameters:
CopyCode The Code is as follows: function classx (name ){
This. Name = Name;
Classx. Prototype. Show = function (PARAM ){
Alert (this. Name + "" + PARAM );
};
}
VaR o = new classx ("name ");
O. Show
I am very happy to have you read the examples of Ajax that I have written. Whether you are your first friend or an old friend, I will show you what I have learned so far,
What Is Ajax?
Important: Ajax is not a language, but a combination of
Jquery1.3.2 and jquery1.4 + do not exist.
Through comparison, we finally find a difference between the two versions.
Jquery1.4 + added a section in the Ajax Method
CodeUsed to call the onreadystatechange method in abort.
Copy codeThe Code is as
At the same time, I will also show how to use JavaScript scripts and Dom interfaces to create a table for the webpage and display the Ajax request data to the table.
In the result of this Ajax instance, the requested server webpage is still:
1. [Use IFRAME]
Add an IFRAME to the page to be loaded, as shown below:
CopyCode The Code is as follows:
Add the function you want to call in onload. If the loaded page is in the pop-up layer, this function should be placed on the parent
First look at the call method:
CopyCode The Code is as follows: Ajax. Request ("ajax.html", {v: Math. Random (), num: 1}, function (data ){
// Do something
}, 'Get ');
The method is like jquery... I still think this call is more convenient...
(I am afraid that I will forget to use it later, so I don't have much explanation. If I really don't understand it, follow my code to give it a try)
I use php at the backend. One of the main functions of the following code is to provide an interface
Tip: We should always pay attention to browser cache. When using the GET method, we should add the timestamp parameter (net Date ()). getTime () to ensure that the URLs sent each time are different, so that browser cache is avoided.
Tip: when a
Smart. asp
Copy codeThe Code is as follows:
Code:Copy codeThe Code is as follows: Response. charset = "UTF-8"Dim url, method, data, charsetUrl = Request. Form ("targeturl ")Method = Request. Form ("method ")Data = Request. Form ("data ")Charset =
Copy codeThe Code is as follows: Easy. Ajax = {
ProxyPool :{
Length: function (){
Var I = 0;
For (var p in this)
I ++;
Return I-1;
}
},
Index: 0,
Async: true,
XmlData: false,
Timeout: 1,
DefaultHeader: 'application/json; charset = UTF-8 ',
Revoke
Some pages that are frequently used by AJAX are sometimes not dare to be refreshed, because after refreshing, you may see a very different page from the original one. I will not discuss whether to use AJAX in the case of a large number of page
With this example, we hope that the content of example.html will be retrieved using the method of ajax, and then the div of the page id = callbackdemo3 will be dynamically updated.
The HTML is as follows:
Copy codeThe Code is as follows:
ajax load1
Example:
Rsajax. js:
Copy codeThe Code is as follows: var http_request = false;
Function makePOSTRequest (url, parameters ){
Http_request = false;
If (window. XMLHttpRequest ){
Http_request = new XMLHttpRequest ();
If (http_request.overrideMimeType )
Because jquery is used, the. abort () method is not found in the manual. I searched the internet and found it at http://ooxx.me/jquery-ajax-abort.orz. the usage of. abort () in jquery is directly used as an example:
Copy codeThe Code is as follows:
Especially after the popularity of Jquery, porotype, Ext and other frameworks, a large amount of simplified code can be said to bring the gospel to programmers,
Free from the heavy work of code, you can easily implement the complex functions of
Yes, what we want to achieve today is to read and Display Server data without refreshing the webpage.
Take out what we prepared last time.
1: function of the XMLHTTPRequest object.
2: Asp outputs an xml file. You can click to view the File
I will introduce the original ajax series tutorials in the Web circle. If you do not know what ajax is, please read: What Is ajax?
Before that, we need to make some simple ajax preparations, but you must have basic html, javascript, and dom
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.