What to dig into-Ajax efficient development

Source: Internet
Author: User

Get/post Request

Post send data 2 times, one header, one body, so post will be faster

Xmlhttprequest.getallresponseheaders ()

Xmlhttprequest.responsetext

Xmlhttprequest.setrequestheader

Xmlhttprequest.open ()

Xmlhttprequest.send

Cross-domain requests: dynamic footstep insertion

Multipart XHR: Slicing processing

http://techfoolery.com/mxhr/

Imagestring.split (' \u0001 '),

if (req.readystate===3) {

Window.setinterval (FN, 15)

Req.responseText.substring (lastlength, length)

}

The most lightweight request "semaphore"

var params=["step=2", ' page=3 ']

New Image (). src=url+ '? ' +params.join (' & ')

Image.onload=function () {

if (this.width==1) {success}

if (this.width==2) {failure, try again}

}

Data format: Performance comparisons, pros and cons

Verbose XML, Verbose json, simple JSON, Array JSON, Custom Format (Script insertion)

Simple XML, Verbose json-p, simple json-p, Array json-p, Custom Format (XHR)

Data cache: Cookie, Last Modified Date, Expire, Request Header, Server side configuration

Long Poll:

iframe, Comet,

What to dig into-Ajax efficient development

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.