No' Access-Control-Allow-Origin'头Ajax - PHP

时间:2014-05-20 13:25:41

标签: php ajax

我遇到了ajax调用问题

来自网站A:

 function getNativeAdvJson(nick){
    getAdv(nick);
    var newArray = new Array();
    nick_cliente=nick;
    origine=self.location.href;
         URL = LINK_BASE_URL_GHOST;
    var o = { 'nick_cliente': nick_cliente, 'origine': origine, 'azione':     'visualizzazione' };
    newArray.push(o);
    $.ajax({
    type:'POST',
    url:URL,
    async: false,
    crossDomain: true,
    dataType: 'jsonp',
     data: { jsonp: newArray }
    });
}

PHP PAGE

     header('Access-Control-Allow-Origin: *'); 
    header('Access-Control-Allow-Methods: GET, PUT, POST, DELETE, OPTIONS');
    header('Access-Control-Allow-Headers: Content-Type, Content-Range, Content-Disposition,     Content-Description');
    header('Content-Type: application/json'); 

我有错误

XMLHttpRequest无法加载PAGE PHP。请求的资源上不存在“Access-Control-Allow-Origin”标头。因此,不允许原点“网站A”访问。

我怎么解决它?

感谢

0 个答案:

没有答案