function searchNews(keyword){ $.ajax({ contentType: "application/json;charset=utf-8", cache:false, url:`https://way.jd.com/jisuapi/newSearch?keyword=${keyword}&appkey=68b4fd6acabbe498b29fdc67d3f23203`, success:function(data){ console.log(data); }, })}searchNews('姚明');控制台报错Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost' is therefore not allowed access.而我把url粘贴到浏览器地址后,在浏览器里面可以看到正确的返回信息求问这是什么原因导致ajax无法调用?
添加回答
举报
0/150
提交
取消