Sometimes in a business event processing process, you may encounter a click of a button or other event that triggers an action.Requires more than two AJAX requests, but may be concerned with the sequencing of Ajax requests, and sometimes the order
1:
JSON (Javascriptobject notation) is a simple data format that is lighter than XML. JSON is the native format of JavaScript, which means that processing JSON data in JavaScript does not require any special APIs or toolkits.The rule of JSON is
A simple example of Ajax: Selecting a book will get the relevant name in real time via Ajax.
Put 4 HTML files under the same file in your Web site.
Index.html
Copy Code code as follows:
A simple Ajax instance that does not
It's not the first time you've been using AJAX to request data (and that's what it's all about), just yesterday I ran into a problem? The project needs to use Ajax to make the data request, so envelope the AJAX code copy to the project, front-end,
ajaxtext1.jsp
Copy Code code as follows:
Input:
Golden Ball: Lionel Messi
c Luo
ajaxtest2.jsp
Copy Code code as follows:
Request.setcharacterencoding ("Utf-8");
String
This example uses jquery.form.js, please go to the demo page to view
CSS Code
Copy Code code as follows:
Xml/html Code
Copy Code code as follows:
0%
JavaScript Code
Now a more popular AJAX-style web page loading, see more in a number of Web sites using AJAX technology, page load will automatically show the message, with load animation effect, the page loaded automatically disappear, is a loading feature of the
Copy Code code as follows:
var xmlhttp = null;
function Myajax () {
1. Create XMLHttpRequest Objects
2, the need for IE and other browsers to create this object different ways to write different code
if (window. XMLHttpRequest) {
For
Copy Code code as follows:
function Creatajax () {
var ajax=null;
if (window. XMLHttpRequest) {
Create XMLHttpRequest objects for browsers such as Mozilla, Netscape, and Safari
Ajax = new XMLHttpRequest ();
if (Ajax.overridemimetype) {
If
Copy Code code as follows:
/*
Get and post methods to prevent repeated requests from Ajax
*/
Jquery.extend ({
Getx:function (Url,data,callback,sender) {
var params={url:url,data:null,callback:null,sender:null};
for (Var i=1;iif
Look through the data and get the result: no
But at the same time also found a solution, is to use the way to the IFRAME to submit the form, that is, the implementation of no refresh submission form can upload files!
One, HTML code
Copy Code
In particular, after the popularity of frameworks such as Jquery,porotype,ext, a lot of simplified code can be said to bring the gospel to programmers,
From the heavy work of the code to release, easy to achieve the past to write complex
Yes, the effect we're going to make today is. Read and display server-side data without refreshing the page.
Take out the things we prepared last time.
The function of the 1:xmlhttprequest object.
2:asp output XML-formatted file. You can click to
I will launch the AJAX original series tutorial in the Web circle, if you don't know what Ajax is, please read: What is AJAX?
Before this we need to do a simple AJAX preparation, but you have to have the basic html,javascript,dom writing ability.
Creates a XMLHttpRequest object.
Copy Code code as follows:
return window. ActiveXObject? New window. ActiveXObject (' Microsoft.XMLHTTP '): New XMLHttpRequest;
A onreadystatechange event for the secondary object. There are two
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