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