-2

I am trying to access a web service but getting cross domain access-control-allow-origin error

$.getJSON("https://beevou.net/oauth/token?grant_type=password&username="+user+
 "&password="+pass+"&client_id=NTEzZGU5MThlNDQ0YWM0&client_secret=45d1002085db5dca4dbdbc5f83731     d19662cb265",
 function(data) {
 console.log(JSON.stringify(data)); 
});

This is the url. Cant change anything at web service side. Let me know some solution to get rid of this problem

thanks in advance

user1175121
  • 123
  • 1
  • 1
  • 8

2 Answers2

1

Basically, if you can't get a JSONP access or obtain from the server they set the necessary CORS headers, the only possible solutions are on your server :

  • issue the request on your server and serve the result for your page
  • set up a proxy on your server to let the browser think everything comes from the same origin (this is the easiest solution, for example with mod_proxy if your server is Apache based)
Denys Séguret
  • 372,613
  • 87
  • 782
  • 758
0

Can you get a result if you change the dataType to JSONP? Like:

$.ajax({
    dataType: 'jsonp', 
    url: "https://beevou.net/oauth/token?grant_type=password&username="+user+
 "&password="+pass+"&client_id=NTEzZGU5MThlNDQ0YWM0&client_secret=45d1002085db5dca4dbdbc5f83731     d19662cb2652",
    success: function(data) {
        console.log(data);
    },
    error: function() {
        alert('nok');
    }
});
Denys Séguret
  • 372,613
  • 87
  • 782
  • 758