-1

I am using the YQL of Yahoo to get some data. I need to send my request Yahoo's YQL because If is normally uses an AJAX request I will get CORS error's. I had worked for several months now but today. I am only getting this back:

query: {count: 0, created: "2017-09-09T08:06:15Z", lang: "nl-NL", results: null}

I don't know what I can do I have tried keep sending requests until you got a result but it's just keeps loading.

The AJAX request:

var REST_PUBLIC_BITTREX = "http://www.bittrex.com/api/v1.1/public/";
var REST_CURRENCY_BITTREX = REST_PUBLIC_BITTREX + 'getcurrencies';
var getAllAvailableCoinsBITTREX = function () {
    var url = REST_CURRENCY_BITTREX;
    var yql_url = 'https://query.yahooapis.com/v1/public/yql';
    $.ajax({
        'url': yql_url,
        'data': {
            'q': 'SELECT * FROM json WHERE url="' + url + '"',
            'format': 'json',
            'jsonCompat': 'new'
        },
        'dataType': 'jsonp',
        'success': (function (data, textStatus, jqXHR) {
            console.log('Bittrex',data);
            if (data.query.results == undefined) {
                getAllAvailableCoinsBITTREX();
            }
            else{
                getThePriceOfAvailableCoinsBITTREX(data.query.results.json);
            }
        })
    });
};
Steven
  • 1,404
  • 2
  • 16
  • 39
  • What are you sending down in your request? What do you expect to get back? – BenM Sep 09 '17 at 08:10
  • I am sending a request to the API from Bittrex and I except to get data of cryptocoins back – Steven Sep 09 '17 at 08:11
  • Please share how you're sending down the request. – BenM Sep 09 '17 at 08:12
  • I have edited and add the code – Steven Sep 09 '17 at 08:13
  • Because the code in the question uses `'dataType': 'jsonp'`, that code and any possible problem you’re running into with it have nothing to do with CORS. So by (re)tagging it with the `cors` tag (and removing the `jsonp` tag), you’re just wasting the time and attention of people here who are expecting the `cors` tag to only have questions that are actually related to CORS. So please consider (re)removing the `cors` tag and (re)adding the `jsonp` tag so that it’s more clear to other people here what the question actually relates to. – sideshowbarker Sep 09 '17 at 10:04
  • Okey I understand it but when I send the request trough a normal AJAX request is got CORS problems .That is the reason why I tagged it with CORS and not JSONP – Steven Sep 09 '17 at 10:06

1 Answers1

0

I have found the problem. I was trying to get to find an other proxy and it give me an error unsecure. Because of the proxy wasn't https.

So I checked my Bittrex link again: I was http. So I say lets try it with https. And the Yahoo YQL started to return values back.

The only thing I needed to do was this:

Change that: "http://www.bittrex.com/api/v1.1/public/";

In to this: "https://www.bittrex.com/api/v1.1/public/";

Steven
  • 1,404
  • 2
  • 16
  • 39