Search code examples
jqueryajaxasp.net-mvcjsonp

GetJSon not suceeding


The following code is calling a translator

var url = "https://api.lingo24.com/mt/v1/translate";

$.getJSON(url + "?user_key=9e56f5d5e5b5647a32ccb58f7bcd8327&q=test&source=en&target=fr&callback=callback", function (data) {
        alert("success");
        alert(data.translation);
    });

user_key Your User Key

q Text for translation

source Language of source text

target Target language for translated text

I have tried both this way and with the $.ajax but neither is returning a result. The website itself returns a result. If someone has an idea what I am doing wrong I would seriously appreciate it.

Request

curl -v  -X POST "https://api.lingo24.com/mt/v1/translate" -d 'user_key=9e56f5d5e5b5647a32ccb58f7bcd8327&q=test&source=en&target=fr'

Response Body

{
 "translation": "Testez",
 "success": "true"
}

Response Code

200

Response Headers

Access-Control-Allow-Origin: *
Content-Encoding: gzip
Content-Type: application/json
Date: Sat, 27 Dec 2014 04:47:18 GMT
Server: openresty
X-3scale-proxy-secret-token: Shared_secret_sent_from_proxy_to_API_backend_71a6eb471024e8db
Content-Length: 68
Connection: keep-alive

Solution

  • I pasted this in web browser and found out why it is not working,

    https://api.lingo24.com/mt/v1/translate?user_key=9e56f5d5e5b5647a32ccb58f7bcd8327&q=test&source=en&target=fr

    The error was.

    Language not included in your current plan.

    fr is not included in your current plan?