0

I don't have access to the server I want to post to. As a result I'm getting

XMLHttpRequest cannot load http://worldcuppool.local:2490/token. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:58402' is therefore not allowed access error.

my post request is:

$.ajax({
    url: 'http://worldcuppool.local:2490/token',
    type: "POST",
    dataType: "json",
    data: 'grant_type=password&username=Alex&password=pswrd',
    success: function (data, textStatus, jqXHR) { alert("success"); },
    error: function (jqXHR, textStatus, errorThrown) {
        console.log(jqXHR);
        alert("failure");
    }
});

Hoe to get response from the server?

31415926
  • 3,811
  • 7
  • 47
  • 78
  • @adeneo, still.. don't see the answer to my question.. what should i use? – 31415926 Jul 22 '14 at 12:29
  • There is no "what should I use", there's a policy in place, and if you don't have access to the server you're posting to, you can't circumvent it, it's just not possible. You have to call the service with serverside code, and then call your own server with ajax etc. – adeneo Jul 22 '14 at 12:43

0 Answers0