Ajax Request VS Normal request

Source: Internet
Author: User

The AJAX request (asynchronized) differs from the message header (header) of the normal request (synchronized):

String Reqtype = Request.getheader ("X-requested-with"), if (null = = Reqtype) {//normal request}else if (Reqtype.equals (" XMLHttpRequest ")) {//ajax Request}

1. Request headers

    1. Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8

    2. accept-encoding: gzip, deflate, SDCH

    3. accept-language: zh-cn,zh;q=0.8,en;q=0.6

    4. Connection: keep-alive

    5. Cookie: bd_home=0; bd_upn=12314353; Baiduid=6d80ec15fb3f7d55f6cf21531b4789a2:fg=1

    6. Host: www.baidu.com

    7. Referer: http://news.baidu.com/

    8. upgrade-insecure-requests: 1

    9. user-agent: mozilla/5.0 (Windows NT 6.1; WOW64) applewebkit/537.36 (khtml, like Gecko) chrome/47.0.2526.106 safari/537.36

Response headers

  1. Bdpagetype: 1

  2. bdqid: 0xcc5e27ca0001088a

  3. Bduserid: 0

  4. Cache-control:p rivate

  5. Connection: keep-alive

  6. content-encoding: gzip

  7. content-type: text/html; Charset=utf-8

  8. cxy_all: baidu+1e0afc7905a9c9dcea7d6f252627f95b

  9. Date: Fri, 06:35:43 GMT

  10. Expires: Fri, 06:35:22 GMT

  11. Server: bfe/1.0.8.14

  12. Set-cookie:P stm=1462516543; Expires=thu, 31-dec-37 23:55:55 GMT; max-age=2147483647; path=/; Domain=.baidu.com

  13. Set-cookie: __bsi=17208040824016918998_00_2870_r_n_6_0303_c02f_n_i_i_0; Expires=fri, 06-may-16 06:35:48 GMT; domain=www.baidu.com; path=/

  14. Set-cookie: h_ps_pssid=1442_19713_18281_19805_19899_19559_19807_19843_19902_19861_17001_15263_12288; path=/; Domain=.baidu.com

  15. Set-cookie: BIDUPSID=6D80EC15FB3F7D55F6CF21531B4789A2; Expires=thu, 31-dec-37 23:55:55 GMT; max-age=2147483647; path=/; Domain=.baidu.com

  16. Set-cookie: bd_home=0; path=/

  17. Set-cookie: bdsvrtm=0; path=/

  18. transfer-encoding: chunked

  19. Vary: accept-encoding

  20. x-powered-by: hphp

  21. x-ua-compatible: ie=edge,chrome=1

2. Ajax Asynchronous Request headers

  1. Accept: Text/javascript, Application/javascript, Application/ecmascript, Application/x-ecmascript, */*; q=0.01

  2. accept-encoding: gzip, deflate, SDCH

  3. accept-language: zh-cn,zh;q=0.8,en;q=0.6

  4. Connection: keep-alive

  5. Cookie: baiduid=6d80ec15fb3f7d55f6cf21531b4789a2:fg=1; pstm=1462516543; bd_home=0; h_ps_pssid=1442_19713_18281_19805_19899_19559_19807_19843_19902_19861_17001_15263_12288; __bsi=17208040824016918998_00_2870_r_n_6_0303_c02f_n_i_i_0; bidupsid=5081a970dd87c74cffbadf0b28a1af39; bd_upn=12314353

  6. Host: www.baidu.com

  7. Referer: https://www.baidu.com/

  8. user-agent: mozilla/5.0 (Windows NT 6.1; WOW64) applewebkit/537.36 (khtml, like Gecko) chrome/47.0.2526.106 safari/537.36

  9. x-requested-with: XMLHttpRequest

Ajax Asynchronous Response Headers

    1. Cache-control:p rivate

    2. Connection: keep-alive

    3. content-length: 95

    4. content-type: Baiduapp/json; v6.27.2.14; Charset=utf-8

    5. Date: Fri, 06:35:45 GMT

    6. Expires: Fri, 07:35:45 GMT

    7. Server: bfe/1.0.8.14

    8. Set-cookie: __bsi=16943568347195085118_00_0_i_r_1_0303_c02f_n_i_i_0; Expires=fri, 06-may-16 06:35:50 GMT; domain=www.baidu.com; path=/


Ajax Request VS Normal request

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.