Config $config in shopnc[‘wap_site_url’]=http://mall.m.ygt.cm;, resulting in the cross-domain implementation of AJAX requests (GET, POST), and the process of implementing cookies in the request header
1. The request code of $.getjson is shown in Figure 1.0
2. Check the network and find that in the response cookie, a new phpssssid is generated, as shown in Figure 1.1

Check the network and find that in the response cookie, a new phpssssid is generated, as shown in Figure 1.1
3. Add to the request address of $.getjson: &callback=?, which is equivalent to setting the request format to jsonp, as shown in Figure 1.2

Add to the request address of $.getJSON: &callback=?, which is equivalent to setting the request format to jsonp, as shown in Figure 1.2
4. Check the network and find that the request cookie has been consistent with the current URL, as shown in Figure 1.3

Check the network and find that the request cookie has been consistent with the current URL, as shown in Figure 1.3
5. The post request under $.ajax, the code is as shown in Figure 2.0
6. Check the network and find that in the response cookie, a new phpssssid is generated, as shown in Figure 2.1

Check the network and find that in the response cookie, a new phpssssid is generated, as shown in Figure 2.1
7. js code implementation: datatype:jsonp,CrossDomain: true, as shown in Figure 2.2
8. Check the network and find that the request cookie has been consistent with the current URL, but the POST request has been converted into a GET request, as shown in Figure 2.3

Looking at the network, it is found that the request cookie has been consistent with the current URL, but the POST request has been converted into a GET request, as shown in Figure 2.3
9. js code implementation: datatype:json,xhrfields:{withcredentials:true},crossDomain: true, as shown in Figure 2.4

JS code implementation: dataType:json,xhrfields:{withcredentials:true},crossDomain: true, as shown in Figure 2.4
10. PHP code implementation:
header(“access-control-allow-credentials: true”);
header(“access-control-allow-origin: ” . c(wap_site_url) . “”);
where c(wap_site_url) is the value of:http://mall.m.ygt.cm, as shown in Figure 2.5

PHP code implementation:
header(“access-control-allow-credentials: true”);
header(“access-control-allow-origin: ” . c(wap_site_url) . “”);
where c(wap_site_url) is the value of:http://mall.m.ygt.cm, as shown in Figure 2.5
11. Check the network and find that the request cookie has been consistent with the current URL, as shown in Figure 2.6

Check the network and find that the request cookie has been consistent with the current URL, as shown in Figure 2.6
12. The code implementation of document.cookie in js: domain=.ygt.cm; as shown in Figure 2.7
13. The POST request under $.ajax, the code is as shown in Figure 3.0, and the format is jsonp; in fact, you can also use a processing scheme consistent with the post request under $.ajax, use the format json, and then set xhrfields



