I am trying to write a Google Chrome Extension. In my manifest.json, I have the following line;
"content_security_policy": "script-src 'self' https://ajax.googleapis.com https://api.uber.com; object-src 'self'",
When I do an jQuery Ajax call to "https://api.uber.com/v1/estimates/time", I am getting;
Failed to load resource: the server responded with a status of 405 (Method Not Allowed)
albooker.html:1 XMLHttpRequest cannot load https://api.uber.com/v1/estimates/time......
No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'chrome-extension://elgjhbhandpgpankfcdmlmndilgledee' is therefore not allowed access. The response had HTTP status code 405.
AJAX code;
$.ajax({
type: "GET",
dataType: "json",
url: uberURL,
success: function( jsondata ) {
// Call function to display details
alert(JSON.stringify(jsondata));
}
I have pasted the generated URL uberURL into a browser and that returns the expected data. –
Am I doing this the correct way? Thanks