Yelp/yelp-fusion

CORS issue with AJAX request

thedanotto opened this issue · 1 comments

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;
      }
    })
  }

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