即使添加了标题,它也会显示:
从原点“ http://eg.com”到“ http://localhost:8080”处对XMLHttpRequest的访问已被CORS策略阻止:对预检请求的响应未通过访问控制检查:否'Access-Control-Allow-来源的标头出现在请求的资源上。
$.ajax({
url: 'https://bhuvan-rcc.nrsc.gov.in/msetcl/mobile/download_lines.php',
headers: {
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Headers': '*',
'Access-Control-Allow-Methods': 'POST, GET, DELETE'
},
type: 'POST',
crossDomain: true,
dataType: 'json',
success: function (data) {}