尽管存在子域,但在策略中存在跨源阻塞

时间:2016-12-09 13:11:49

标签: ajax apache cors

您好我正在尝试使用从子域(app.example.com)到www.example.com的交叉来源。当我尝试执行ajax时,我收到了这个:

Header always set Access-Control-Allow-Origin "http://app.example.com"
Header always set Access-Control-Max-Age "1000"
Header always set Access-Control-Allow-Headers "X-Requested-With, Content-Type, Origin, Authorization, Accept, Client-Security-Token, Accept-Encoding"
Header always set Access-Control-Allow-Credentials "true"
Header always set Access-Control-Allow-Methods "POST, GET, OPTIONS, DELETE, PUT"

我不明白我应该如何使用它..在我的apache conf文件中,我有这些行以启用交叉原始策略:

        $.ajax({
                method: "GET",
                url:'http://www.example.com/index.php?logout',
                        crossDomain: true, 
                        dataType: "json",
                        xhrFields: {
                        withCredentials: false
                        },
                         success: function(data){
                             loginPresta(email,password,companyName);
                         if(data == 'ok') {
                         }
                     },
                     error:function(data){  

                     }
                });

我的ajax电话:

parent="@android:style/TextAppearance.Material.Notification.Title"

0 个答案:

没有答案