84669 person learning
152542 person learning
20005 person learning
5487 person learning
7821 person learning
359900 person learning
3350 person learning
180660 person learning
48569 person learning
18603 person learning
40936 person learning
1549 person learning
1183 person learning
32909 person learning
I have processed the header here, why is there still a cross-domain problem
认证0级讲师
I can’t see the picture clearly. Is this written in nodejs?
res.header("Access-Control-Allow-Origin", "*"); res.header("Access-Control-Allow-Headers", "X-Requested-With"); res.header("Access-Control-Allow-Methods","PUT,POST,GET,DELETE,OPTIONS"); res.header("X-Powered-By",' 3.2.1') res.header("Content-Type", "application/json;charset=utf-8");
node跨域 请参考
Are you using express framework? This is how my express framework program works:
app.all('*', function(req, res, next) { res.append('Access-Control-Allow-Origin', '*'); next() });
You need to process all requests in a unified manner and set the res header to allow cross-domain requests. I don’t know how to write your code specifically. If you still can’t solve it, I suggest you post the code and take a look.
Just use jsonp to cross domain
getJSONDATA(){ $.ajax({ url: "xxx", //接口地址 data: {xxx}, //传参 dataType: "jsonp", jsonpCallback: "person", //核心cb success: function (data) { console.log(data.s); } }); },
I can’t see the picture clearly. Is this written in nodejs?
res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Allow-Headers", "X-Requested-With");
res.header("Access-Control-Allow-Methods","PUT,POST,GET,DELETE,OPTIONS");
res.header("X-Powered-By",' 3.2.1')
res.header("Content-Type", "application/json;charset=utf-8");
node跨域 请参考
Are you using express framework? This is how my express framework program works:
You need to process all requests in a unified manner and set the res header to allow cross-domain requests. I don’t know how to write your code specifically. If you still can’t solve it, I suggest you post the code and take a look.
Just use jsonp to cross domain