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