2

I try to get information from an online dictionary api. I've sent too many queries, so they blocked me. That's not the problem, I'm just trying to handle this and notify the user that he/she got blocked because of too many queries.

But here's the problem: though I see a json file in the browser when I try to use the api directly, I can't get the same message using jQuery on my website's client side. Here's the code:

    function getMeaningList(expression) {


    $.ajax({
        url: "http://glosbe.com/gapi/translate?from=eng&dest=hun&format=json&phrase=" + expression,
        dataType: "jsonp",
        success: function (data) {
            alert("SUCCESS!!!");
            sendJsonToServerForParsing(expression,data);

        },
        error: function (xhr, status, error) {
            console.log('sendJsonToServer error');
            alert('sendJsonToServer error');
        }

    });

}

When I test this part of the code, I don't see either the success or the error alerts. The function itself runs through.

If I check it in firebug, I see the following: enter image description here

I'd like to add that the same code works when I'm not blocked. What happens here? (why is it that neither of the two callbacks gets called?)

Tyler Durden
  • 2,031
  • 4
  • 20
  • 25
  • 1
    See http://en.glosbe.com/a-api#H2_Terms_of_Service: _API is free to use, regarding indicated data source license. There is a limit of call that may be done from one IP in fixed period of time, to prevent from abuse. The limit is not strict, there is heuristics that guesses whether queries comes from robot or human. If there are too many queries or they look non-human – IP gets blocked. If you are a developer and such case happens: please contact us._. You may want to contact them with your use case. – Nivas Jun 30 '14 at 20:32
  • 4
    `jQuery.ajax`'s `error` function is not called for cross-domain `jsonp` requests. http://api.jquery.com/jquery.ajax/ – Collin Anderson Jun 30 '14 at 20:40

0 Answers0