Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Becky Christofferson
15,047 PointsAjax and No 'Access-Control-Allow-Origin'
I have a project I'm working on and I'm trying to pull from a Google API.
Right now, I'm getting a "No 'Access-Control-Allow-Origin'" error. I've added the following php:
<?php
header('Access-Control-Allow-Origin: *');
header("Access-Control-Allow-Credentials: true");
header('Access-Control-Allow-Methods: GET, PUT, POST, DELETE, OPTIONS');
header('Access-Control-Allow-Headers: Content-Type, Content-Range, Content-Disposition, Content-Description');
?>
And here is my Ajax call:
$.getJSON(path,function(data) {
console.log(typeof(data));
});
Becky Christofferson
15,047 PointsI'm trying to use the Google Elevation API.
wuworkshop
3,429 Pointswuworkshop
3,429 PointsCould you give more details? Which Google API are you trying to make a request?