dongshen4129
dongshen4129
2015-07-08 12:50

在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!!

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

2条回答

  • drurhg37071 drurhg37071 6年前

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

    <?php
    header('Access-Control-Allow-Origin : *'); 
    
    ...
    
    点赞 评论 复制链接分享
  • dsgdhtr_43654 dsgdhtr_43654 6年前

    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

    点赞 评论 复制链接分享

为你推荐