Doing Web applications often requires uploading.
So, Ajax uploads are often used.
Share a jquery Ajax upload component Ajaxfileupload.
The usage is simple:
The code is as follows
Copy Code
/upload.html is
Summary of their own in the project to do the most is the provincial urban linkage selection.
One is the provincial urban style is the three select box, directly selected, the style is as follows:
One is the province select box exists, the city,
HTML page code
The code is as follows
Copy Code
function Errors (msg){Alert (msg);}
action.php page
The code is as follows
Copy Code
if ($input = = ") {echo " ";Exit}
So
Ajax garbled Solution One:
Specify the format for sending data on the server:In the JSP file:Response.setcontenttype ("text/text;charset=utf-8")/txt text file returnedOrResponse.setcontenttype ("Text/xml;charset=utf-8")//returned XML filePhp:header
encodeURIComponent will be encoded in Utf-8, under GBK encoding, can you encode it with GBK?
If you are still playing encodeuricomponent idea, then sorry, encodeURIComponent will only utf-8 code, and no other API to do other coding; but don't worry,
JS Getting Started Tutorial one (the role of web effects in AJAX example)
New Document
root node
Sub-node 1
Sub-node 2
Sub-node 3
Sub-node 4
A simple multiplication table to add annotations to achieve the 99
Make a half day originally click submit button Less added a type="button" turns out to be the result how to do will refresh the page, plus just fine
Automatic refresh after Ajax commit when button is present in ps:form form
In the
Objective
This is a common requirement: Click on the page number to update pages locally (not overall refresh) and generate historical management. Local refresh is easy to implement, Ajax can meet our needs, but this does not produce historical
Users don't like scroll bars, so we made a tab switch, users do not like to refresh the page, so we are going to use Ajax, in the last few years, almost every web developer, have a little bit of Ajax pride, but know that using Ajax is not enough,
In this paper, the method of realizing Ajax by JS is analyzed. Share to everyone for your reference, specific as follows:
One, what is Ajax
Read data or submit data without refreshing
(first appeared Ajax: Google Maps, drag a new view of the show)
Scenario 1: When there are new messages, the Web page automatically pops up the message without requiring the user to manually refresh the Inbox.
Scenario 2: When the user's mobile phone scan completes the two-dimensional code in the page, the page
As we all know, the verification code in our life are very common, many companies are tossing a variety of verification code, here briefly with a small case to achieve the function of the Verification code (PS: I really hate the verification code
The online solution is to add jquery.support.cors=true before initiating the request; However, offline testing, is OK, one on the server, there are new eroor:readystate:0, status:0, StatusText: " Error: Access Denied ...
Finally, the problem is
1. Native Ajax
difference between get request and POST request: yellow small triangle
Take the GET request as an example, the output is as follows:
Ajax in the 2.jquery
The 6 commonly used methods are listed:
3. Status Description
1, Ajax sends the request state to judge if else statement problem.
var xhr = new XMLHttpRequest ();
Xhr.open ("Get", strURL);
xhr.onreadystatechange = function () {
if (xhr.readystate = = 4) {
if (xhr.status ===200) {
The advantages of loading on demand: In the actual survey found that a lot of netizens in the site with a clear point of reference, often in the home page directly after the search into their own needs of the list of goods, if the customer entered
Step three: Send the data to the ASP script for processing.
Response.ContentType = "Text/html"Response.Charset = "GB2312" ' solve garbled problemResponse.buffer=true ' Disables cachingResponse.expires=0Dbdir= "Ajax.mdb"Set Conn=server.createobject (
Example 1: log on directly using $. ajax The code is as follows:Copy code $. Ajax ({// Submit the addressUrl :"",// Submitted dataData: {key1: value1, key2: value2, key3: value3, key4: value4 },// Events before submissionBeforeSend: function
Async is true by default, that is, asynchronous mode, $. after Ajax is executed, the following steps are continued after ajax is executed until the server returns data, triggering $. success method in Ajax. at this time, two threads are executed.
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