I am puzzled by the question. The documentation says that you can use the curl query:

curl -s -X POST -H ... \ -H ... \ --data "{ .... }" "https://translation.googleapis.com/language/translate/v2" 

But I would like to use javascript. Like that:

 $.ajax({ url: 'https://translation.googleapis.com/language/translate/v2', type: 'post', data: { .... }, headers: { ...., .... }, dataType: 'json' }); 

Tell me if there is a difference. And do not chase, please, with sticks. Just starting to deal with requests

    1 answer 1

    Tell me if there is a difference.

    The call comes from the depths of the command line, can be processed by system commands or files that will be on the server side, can also be displayed in the browser (optional).

     curl -X POST -H Content-Type: application/json \ -H ... \ --data { "someData":"that is formatted as JSON" }' https://translation.googleapis.com/language/translate/v2 

    The call comes from the "depths" of the browser. The response is processed by browser tools, such as JS, displayed directly in the browser (usually on the page that initiated the call).

     $.ajax({ url: 'https://translation.googleapis.com/language/translate/v2', type: 'post', data: { someData: "that is formatted as JSON" }, dataType: 'json', success: function (data) { console.log(data); } }); 

    There are more checks (for example: CORS ) that today's browsers spend, so maybe some requests will go through curl , but not go through browser calls.