Ajax cannot directly transmit objects or arrays. If some users process the data themselves, they can connect the data to a string according to their own standards and then process the data at the backend. However, the data is uncertain, this may
The core of Ajax technology is the XMLHTTPRequest object (xhr ).XMLHTTPRequest objectCreate an xhr object in the browser as follows and use the XMLHttpRequest constructor.VaR xhr = new XMLHttpRequest ();Xhr usageXhr. Open ("get", "example. php",
I. Ajax stands for Asynchronous JavaScript and XML. Asynchronous is asynchronous, which is different from the synchronous method used in traditional web development.
II:About synchronous and asynchronous
Asynchronous transmission is
Using formdata to upload attachments (two methods)
VaR Reg = Document. getelementbyid ('reg ');
VaR FD = new formdata (REG );
Send (FD); // FD contains common form information and Attachment Information
Method 2
VaR mypic = Document.
/* The following code uses ajax to click different links on a web page and display the returned results in a fixed div on the page. */
Insert title here no1 | no2 | no3
Friends who have used AJAX certainly know that javascript is using UTF-8 International encoding, that is, each Chinese character with 3 bytes to store, but this caused the use of AJAX to send data when garbled.One solution is to use
There are still some shortcomings in a previously written Ajax random text refresh. At that time, the following algorithm was used to achieve the value from the server for a period of time:
Var secs = 300; // number of seconds for countdown
Sometimes, when the amount of data processed by Ajax is large, the user waits for a long time. If the user is not prompted to wait at this time, the user may feel impatient. This section describes how to display loading when processing data in Ajax.
In js, if you want to achieve the simplest copy content, you can click the button to copy the content, we will use window. clipboardData. setData (\ "Text \", \ 'contains www. bKjia. c0m \ '); below I will summarize various replication effect codes.
In js, parseInt and parseFloat both define or convert the numeric type, but one is an integer that supports the floating point type, that is, they have different precision.
ParseInt () function: converts a string to an integer. The return value
There are two common methods to use ajax in js: the original XMLHttpRequest method and the popular Jquery ajax method. I will introduce them here.
For Ajax, the core object is XMLHttpRequest. All Ajax operations cannot be separated from operations
Before jquery appeared, we had to use XMLHttpRequest to Create ajax before creating ajax. Next I will take out the ajax I wrote many years ago.
XMLHttpRequest
The Code is as follows:
Copy code
Next let's take a look
This article will summarize the code for passing values between frameworks (iframe) in js, from our most commonly used method to my summary of writing a function and some of the following methods for transferring iframe cross-origin values.
Many
This article will introduce you to the program for redirecting to the specified element. This is a good transfer program. If you need to know about it, you will not be able to access it.
The Code is as follows:
Copy code
/***
The simplest way to copy content in js is to directly use createTextRange () and execCommand () and then there are window. clipboardData. setData and so on. Next I will summarize various application instances.
Example 1
The Code is as
Solution to passing garbled Chinese characters through POST or GET in AJAX
When AJAX is used in web development to pass a Chinese string, Firefox automatically converts the Chinese string to a hexadecimal character, while IE will directly pass the
The $. ajax method in jquery is used to load remote data through HTTP requests. This method is implemented by jQuery underlying AJAX. Some simplified methods include $. get, $. post, and $. getJSON. Because the $. ajax method is often used in 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