I'd like to add a parameter after an URL in a Javascript function. The full URL I'd like to have is: https://my-url.com/section1/section2/here_a_random_number.json?lang=en This is the ".json?lang=en" that I'd like to add at the end of the URL.
Here my function (in a Google script, linked to a sheet):
function myfunction(randomnumber) {
var myUrl = "https://my-url.com/section1/section2/" + escape(randomnumber);
var jsonData = UrlFetchApp.fetch(myUrl);
var jsonString = jsonData.getContentText();
var jsonObject = JSON.parse(jsonString).result;
var name = (jsonObject.name);
Utilities.sleep(2000);
return name;
}
Where could I put/add my language parameter ?