0

I am trying to create an ajax request from my site to my server with an authorization parameter. My domains are not the same but this is handled in the java servlet of the server. The problem is if don't include the header parameter of the code below, the request reaches the server but gives an error of missing authorization header (obviously) BUT when I send the request with the header authorization, I get the "No 'Access-Control-Allow-Origin' header is present on the requested resource" error. Any ideas?

jQuery.ajax({
    url: "someurl",
    type: "POST",   
    headers:
    {
        "Authorization" : "some authorization",
    },
    complete: function(data) 
    {
        // something
    }

});

panpan
  • 31
  • 3
  • 1
    see http://stackoverflow.com/a/20035319/1680422 – David Fregoli Dec 12 '14 at 13:32
  • @DavidFregoli I have seen all related questions. My problem is that I only when I add the "headers" part of the request I get the "Access-Control-Allow-Origin" error. Without it I don't because I actually allow the origin in my java servlet. – panpan Dec 12 '14 at 13:34

0 Answers0