Angular js http request php


Angular js http request php

我试图在angular js上发送表单数据到php页面。但这行不通。这是我的表单:

,这是我的$http请求

    nodes.controller("addNew",function($http){
    var  content = this;
    this.submitNew = function(type)
    {
        //content.body.filter
       $http({method:'POST',url:http+'nodes/create',
               data:{
                   title:content.title,
                   author:content.author,
                   node_author:content.node_author,
                   body:content.body,
                   type:type
               },
               headers:{
                   "Access-Control-Allow-Methods":"POST",
                   'Content-Type': 'application/x-www-form-urlencoded',
                   'Access-Control-Allow-Origin':'*',
                   "Access-Control-Allow-Headers": "Content-Type, Access-Control-Allow-Headers, Authorization, X-Requested-With"
               }
           }
       );
        this.title = '';
        this.author = '';
        this.body = '';
    }
});

这个错误! !

XMLHttpRequest cannot load http://hangoma.lc/nodes/create. Request header field Access-Control-Allow-Origin is not allowed by Access-Control-Allow-Headers

头信息

Remote Address:127.0.0.1:80
Request URL:http://hangoma.lc/nodes/create
Request Method:OPTIONS
Status Code:200 OK

请帮助! !

当您试图从127.0.0.1http://hangoma.lc/nodes/create发出请求时。但远程服务器不允许其他服务器连接(http://hangoma.lc除外)。

您尝试连接的服务器应该包含access-control-标头。你不能强迫这些从你的请求。