Session cross-domain and Ajax cross-domain names

Source: Internet
Author: User

background cross-domain and Ajax Cross-domain:

Background cross-domain:

www.baidu.com Primary domain (first class domain name usually starts with www )

News.baidu.com Level two domain name

(a.test.com and b.test.com have the same domain, and test.a.com are not the same domain)

The same domain can be used Setcookie (' name ', ' session_id ', ' Time () +3600 ', '/', ' domain '); to store session_id .

For example:a.php under the a.test.com b.php under the b.test.con c.php under the test.c.com .

Ajax cross-domain:

For example:test1.html under a.test.com domain name,test2 in b.test.com Domain name, a.php in the a.test.com under

when test1.html and background files a.php under the same domain name

when the test2.html and background files a.php not under the same domain name, that is JSONP

JSONP is a usage pattern for JSON that can be used to address cross-domain data access issues in mainstream browsers. (The cross-domain here is cross-domain, not background-spanning ). Background cross-domain refers to domains that are different, such as a.test.com and test.a.com.

the normal format of JSONP is

$.ajax ({

Url:xxx

DataType: ' Jsonp ',

Callback:getdata (),

})

This format is equivalent to what we wrote above "http://a.test.com/a.php?callback=?" This format.

Session cross-domain and Ajax cross-domain names

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.