Jquery Ajax, will you?

Source: Internet
Author: User

AjaxAdvantages:

1Purpose: request data on demand to reduce the server bandwidth,

2, Without refreshing new requests, improvingWebPerformance, such as Form Verification:

 

 

1,JqueryOfAjaxOperation

JqueryEncapsulationAjaxOperation, usually in the following ways:

Jquery. Ajax ()

$. Get ()

$. Post ()

Load ()

 

(1) load ()A static data file is requested.

1,URL,AjaxRequested address

2,DataData contained in the request (if the data is a collection, transmitted in {} format)

3, Callback function (AjaxThe function executed after the request is successful)

Callback function parameters:1,AjaxReturned data;2,AjaxRequest status;3,XMLHttpRequestObject

 

 

1,Load ()The requested static data file

2Which element object is called?Load ()Method,AjaxThe requested result is displayed on which element

 

How to filter out the data we need

InURLPassing a selector on the parameter

Load (URLSelector)

Content I need to comment on now, no name required

 

 

 

$. Get ()Method To send a request:

The client passesGetMethod to send to the serverAjaxRequest

$. Get (URL, Data, callback)

 

Summary in one sentenceJquery:

JqueryIs an encapsulatedJavascriptLibrary, with its concise syntax and improved browser compatibility, coupled with a powerful selector,DomOperation,AjaxOperation, greatly savingJavascriptDeveloper Manager

Summary in one sentenceAjax:

Ajax,YesJavascriptOperationXMLHttpRequestObject To completeHTTPRequest Process

 

 

Data Types returned by the server to the client:

1,HtmlCodeFragment (string)

 

 

 

 

2,JSON:Json_encode ()When we need to return the data of the Collection class
3,XML:Header ("")

 

Text ()-------Text node content<P> Hello </P>Label content

 

HTML () ---- htmlTags and content<P> Hello </P>

 

 

$. Ajax ()EncapsulationAjaxRequest

But there is only one parameter, so it must beJSONFormat parameters

 

 

1, Request addressURL

2, REQUEST METHODType

3The format of the data returned by the server.

4, Carried dataData

5, Asynchronous request or not

6, Whether to cache data

7, Callback function after success

8, Callback function after failure

 

Related Article

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.