在javascript中写入Access-Control-Allow-Origin:或Origin的位置?

在javascript中写入Access-Control-Allow-Origin:或Origin的位置?

问题描述:

So I came to know by searching that I need to set my Access-Control-Allow-Origin: or Origin tags. But where?? Suggestions were to use these in header.

I can't see find anything that explained this. Can anyone please tell me where to put this tags and how!!

所以我通过搜索来了解我需要设置我的Access-Control-Allow-Origin:或Origin标签 。 但是哪里?? 建议是在标题中使用这些。 p>

我看不到任何解释这一点的内容。 任何人都可以告诉我在哪里放这个标签以及如何!! p> div>

In your PHP file * I guess you have ajax request, etc.*

<?php
header('Access-Control-Allow-Origin : *'); 

...

in the header sent by the server (so, nothing to do with javascript or jqueeery)

and the correct answer is thanks to @Jaromanda X .

 <?php header('Access-Control-Allow-Origin : *'); ?>

in top line