Modification at night
Code, Previously used
Copy codeThe Code is as follows: $. Ajax ({
..
Datatype: 'json ',
...
Success: function (JSON ){
// Disable success
},
Error: function (error ){
// Always execute this error
}
});
Why? After
Copy codeThe Code is as follows: function creatajax (){
Var ajax = null;
If (window. XMLHttpRequest ){
// Create an XMLHttpRequest object for Mozilla, Netscape, Safari, and other browsers
Ajax = new XMLHttpRequest ();
If (ajax. overrideMimeType
Methods In Ajax engine objects:
Abort () stops the current request
GetAllResponseHeaders () returns the complete headers as a string.
GetResponseHeader ("headerLabel") returns a single header label as a string
Open ("method", "URL" [, asyncFlag [
Ajax. js
------------------------- [Ajax class] --------------------------
Copy codeThe Code is as follows: function Ajax (recvType ){
Var aj = new Object ();
Aj. recvType = recvType? RecvType. toUpperCase (): 'html'; // file type passed to the
As follows:
Paste the front-end code first: the key code is to bind the Id through the data (custom attribute) marked by span.
Copy codeThe Code is as follows: DataKeyNames = "Id" onrowdeleting = "GvCollect_RowDeleting"
EnableModelValidation = "True"
Let's take a look at a simple piece of JavaScript code returned by jquery ajax.
Copy codeThe Code is as follows: function getReturnAjax {
$. Ajax ({
Type: "POST ",
Url: "ajax/userexist. aspx ",
Data: "username =" + vusername. value,
Success:
Cache problems:
What is cache problems? That is, when the input content of the browser is the same, that is, the requested URL is the same, the browser will read the cache, and the content of the two requests will not interact with the
Copy codeThe Code is as follows :/*
GET and POST methods that prevent repeated ajax requests
*/
JQuery. extend ({
Getx: function (url, data, callback, sender ){
Var params = {url: url, data: null, callback: null, sender: null };
For (var I = 1; I If
Abstract:
Ajax Learning 1 describes how to use ajax encapsulated by jquery to receive text data from the server and XMLHttpReques object to receive text data from the server.
Ajax 2 describes how to use XMLHttpReques to receive XML data from the
Abstract: In this section, add ajax Study Notes 1.
Method 2: Use the responseXML method of the XMLHttpRequest object to accept the DOM object of the XML data object.
In the ajax study Note 1, you have made a detailed introduction to the preparation
AJAX introduction:AJAX refers to Asynchronous JavaScript And XML (Asynchronous JavaScript And XML), And is a web development technology used to create interactive web applications. Through AJAX, JavaScript can use the XMLHttpRequest object of
The error method is directly executed to indicate an error. ajax jsonp has never been used before. Its understanding is similar to that of common ajax requests, but it is not well understood. This error occurs, after debugging (checking the backend
Let's start with some basic knowledge:
Syntax: $. ajax ({option })
Option indicates the parameter. In the form of key/value.
Common parameters: type: post/get.
Url: the address where the request is sent.
Data: {object: object} the data sent to the
Function Description: The main function is to display data by page. You can configure the page number to be displayed on each page in the configuration file. You can perform multi-condition joint query. Here is just a simple query. You are welcome
Unfortunately, this is not the case with a legacy system I have used. Therefore, the call method is transformed by applying the ajaxPrefilter of jQuery on the client.
Copy codeThe Code is as follows:
ajaxPrefilter demo
Use comparisonCopy
As follows:
1: Non-Ajax
Front-end:
Corresponding background:
2: Ajax of JQuery
Before using JQuery to submit a form, we need to first reference jquery. form. js, which is from http://www.malsup.com/jquery/form/. in this case, the js files to be
AJAX = Asynchronous JavaScript and XML.
AJAX allows asynchronous updates on webpages by exchanging a small amount of data with the server in the background. This means that it is possible to update part of the webpage without reloading the whole
The differences between ajax synchronization and Asynchronization are as follows:
Code 1:
Copy codeThe Code is as follows: Synchronize = function (url, param ){
Function createXhrObject (){
Var http;
Var activeX = ["MSXML2.XMLHTTP. 3.0",
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.