Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CORS issue with AJAX request #64

Closed
thedanotto opened this issue Sep 26, 2016 · 1 comment
Closed

CORS issue with AJAX request #64

thedanotto opened this issue Sep 26, 2016 · 1 comment

Comments

@thedanotto
Copy link

What do I need to do to fix my ajax request?

screen shot 2016-09-26 at 5 58 08 pm

    $.ajax({
      url: "https://api.yelp.com/v3/businesses/search?term=food&location=45-09+34th+Ave+Long+Island+City+ny+11101&radius=50&price=1,2,3,4",
      headers: {
        "Authorization": "Bearer my_token"
      },
      "cors": {
        "headers": ["Accept", "Authorization", "Content-Type", "If-None-Match", "Accept-language"]
      },
      'cache': true,
      dataType: 'json',
      success: function(data) {
        console.log("Your request succeeded!");
        debugger;
      },
      error: function(data) {
        console.log("Your Request ended in an error");
        debugger;
      }
    })
  }
@tomelm
Copy link
Contributor

tomelm commented Sep 27, 2016

Hey @thedanotto! Right now the best option would be to setup a simple backend API to make a request to our API as we don't support CORS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants