(i) Local events
Local event: An event that is bound in a single Ajax request object, and each Ajax request object can bind its own local events as needed. A local event is only triggered by the Ajax object that binds the event, and is a private
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,
Use jquery to send AJAX requests, which are normal under Google's browser, but fail under IE, and the first code is this:
The code is as follows
Copy Code
This code is measured in Google Browser normal, under
First look at the success of the effect of the chart
Before clicking
After clicking
A friend will say this effect with JS can also be achieved, but I do not understand JS so it is only in this way
HTML page (note the ID in the page)
jquery is a packaged JavaScript class library that has its own syntax, and I'll talk about implementing Ajax in the 3 method below jquery. Let's start with the example.
The first method of $. Post (Url,data,callback, type);
First create a new HTML
Fill in the data to be updated No refresh Save
?sava.php file
mysql tutorial _connect ("localhost", "root", "root") or Die (' Database Server Uid or Password error! '); mysql_select_db (' IP ') or die (' Data! '); mysql_query ("Set
Example: Load from Test.js, the name of the JSON data accessed from the returned JSON data
$.getjson ("Test.js", function (JSON) {Alert ("JSON data:" + json.users[3].name);});
For example, loading JSON data from Test.js, and additional data
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
It is not surprising that today's Web sites have asynchronous requests and even many asynchronous requests in a Web page. Ajax has become the basic function of the site now, making Web applications closer to desktop applications.
However, no matter
A method of automatic time saving for AJAX dataWindow.onload=function () {
var txtobj = document.getElementById (' txt1 ');var spanobj = document.getElementById (' s1 ');
Automatically saveTxtobj.addbehavior ("#default #userdata");
var
For example, html code is very simple Here, the status information is displayed in html, because ajax will replace the content, to prevent loading delays, we can provide some logon instructions by default. The code is as follows:Copy code
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 reason is that there are multiple similar asynchronous request actions on the page. Based on the principle of improving code reusability, I encapsulated a function named getData, which receives different parameters, only obtains data and returns
Example! The code is as follows:Copy code * Company name: & nbsp; * Enterprise website: & nbsp; * Your Title: & nbsp; * your mobile phone: & nbsp; & nbsp; remarks: Enter other content you want to talk about!
You can use jquery ajax to submit a form request.Jquery download function: The code is as follows: Copy code // Download an Ajax fileJQuery. download = function (url, data, method ){//
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