I'm trying to send form data on angular js to php page. bu it's not working. here's my form:

and this is my $http request

    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 = '';

    }
});

this error!!!

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

header details

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

Please help!!! i cannot find solution.

share|improve this question

As you are trying to make request to http://hangoma.lc/nodes/create from 127.0.0.1. But the remote server does not allows connection from other servers (except http://hangoma.lc).

The server you are trying to connect should include the access-control- headers. You can not force these from your request.

This question has more details.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.