I believe that we have encountered a lot of cross-domain problems in project development ~
So let me say Ajax (non-JSONP) requests cross-domain bar requires back-end mates
The backend program needs to join the header information across the domain allow
Header (' Access-control-allow-origin: '. $origin); $origin the allowed domain name
Header (' Access-control-allow-methods:post ');
Header (' access-control-allow-credentials:true ');//Allow Cookie access
Front End Program
true }}); $.ajax ({' url ': ' Http://user.cli.me/api/qrcode_template/gettpl ',' data ': {' data1 ':d ata1, ' Data2 ':d ata2, ' type ': ' First '},' type ': ' Post ',' dataType ': ' JSON ',' success ':function (ret) {if(ret.status== ' 1 ') {callback (ret.data);} Else {alert (ret.msg); }})
Native words set the XMLHttpRequest object's
Withcredentials property is True
Ajax cross-Domain Access-control-allow-origin