doubiaozhan0745 2014-10-10 16:49
浏览 916

请求的资源上不存在“Access-Control-Allow-Origin”标头 - 不允许站点

I get this error when I load this page :

No 'Access-Control-Allow-Origin' header is present on the requested resource.

the page is this one : http://vieillemethodecorpsneuf.com/confirmation-achat-2/?item=2&cbreceipt=NT5LQ4FE&time=1412942198&cbpop=103E98FF&cbaffi=CELLULITEF&cupsellreceipt=NT5LQ4FE&cname=nathalie+huard&cemail=n-huard@hotmail.com&ccountry=CA&czip=J2J1M9&cbskin=6553&cbfid=14412&cbf=M3XLQ7WEWB

and complete error is this :

XMLHttpRequest cannot load https://app.getresponse.com/add_contact_webform.html?u=WOoS. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://vieillemethodecorpsneuf.com' is therefore not allowed access.

How can we solve this? Can I put something in the .htaccess file to resolve it?

Please be aware that this page is build under the Wordpress OptimizePress plugin and even if there's a module that can help me to put code in the HEAD section, OP do not allow me to render PHP code with this module. So it is hard to put this code in header:

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

By the way, the complete code that is refering to is :

<?php
$clickbank_name = (isset($_GET['cname'])) ? $_GET['cname'] : ''; 
$clickbank_email = (isset($_GET['cemail'])) ? $_GET['cemail'] : '';
$clickbank_country = (isset($_GET['ccountry'])) ? $_GET['ccountry'] : '';
?>
<script type="text/javascript"    src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script type="text/javascript">

$(document).ready(function(){  
var cname = '<?php echo $clickbank_name; ?>';
var cemail = '<?php echo $clickbank_email; ?>';
var ccountry = '<?php echo $clickbank_country; ?>';
var webform_id = '5068102'; //here your webform id

var dataString = ‘name='+cname+'&email='+cemail+'&custom_country='+ccountry+'&webform_id='+webform_id;
$.ajax({
  type: "POST",
  url: "https://app.getresponse.com/add_contact_webform.html?u=WOoS",
  data: dataString
});
});
</script>
  • 写回答

2条回答 默认 最新

  • dongzangchui2072 2014-10-10 16:54
    关注

    If you call with jquery you should use "crossDomain:true"

    for example:

    $.ajax({    
        type: "GET",
        crossDomain:true,
        url: "http://api.pinterest.com/v1/urls/count.json",
        dataType: "jsonp",
        success: function(e) {
        }
    });
    
    评论

报告相同问题?

悬赏问题

  • ¥15 maple软件,用solve求反函数出现rootof,怎么办?
  • ¥50 汇编语言除法溢出问题
  • ¥65 C++实现删除N个数据列表共有的元素
  • ¥15 Visual Studio问题
  • ¥15 state显示变量是字符串形式,但是仍然红色,无法引用,并显示类型不匹配
  • ¥20 求一个html代码,有偿
  • ¥100 关于使用MATLAB中copularnd函数的问题
  • ¥20 在虚拟机的pycharm上
  • ¥15 jupyterthemes 设置完毕后没有效果
  • ¥15 matlab图像高斯低通滤波