Forums

Give help. Get help.

  • # June 2, 2017 at 1:48 pm

    I am testing out the new fetch API on my localhost.

    I am getting this error message in the console.

    Fetch API cannot load https://api.twitter.com/1.1/search/tweets.json?q=skinny%20puppy. No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Origin ‘http://localhost:7883’ is therefore not allowed access. The response had HTTP status code 400. If an opaque response serves your needs, set the request’s mode to ‘no-cors’ to fetch the resource with CORS disabled.

    This is my code. I’m attempting to use the Twitter API:

    var query = 'https://api.twitter.com/1.1/search/tweets.json?q=skinny%20puppy';
    
    var options = {
      method: 'GET',
      mode: 'cors',
    }
    
    fetch(query, options)
    .then(response => {
      if (response.status >= 200 && response.status  console.log(data))
    .catch(() => console.log("whatever"))
    
    # January 16, 2018 at 12:33 am

    Hello, I wondering if you’ve succeeded to solve the issue you had. I have the same issue (that’s the way I got here). Is it possible to share this with me and help me. Thank you very much! Regards, Elena

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

icon-anchoricon-closeicon-emailicon-linkicon-logo-staricon-menuicon-nav-guideicon-searchicon-staricon-tag