lundi 9 janvier 2023

Multiple random API keys from the list

I have this code below, I want to use randomly API key picked from the list of keys:

function getSomething() {
    //
    var SomethingApiKey = "c40dcc41bb316dec013d";
    var SomethingApiCall = "https://api.website.net/catalog/" + SomethingApiKey + "/" + l + "," + l + "?units=si";
    $.ajax({
      url: SomethingApiCall,
      type: "GET",
      dataType: "jsonp",

I tried this :

var r_text = new Array();
 r_text[0] = "Ge8rp3OJNsoTvCRV";
 r_text[1] = "OZ4W4yBVRxfGc4xp";
 r_text[2] = "zInuwyCmOcuD-OjB";
 r_text[3] = "EcSyDtyL_PT5PCAd";
 r_text[4] = "AdCWLOhkjOAEDSdy";

function search() {
    var nn = Math.floor(5 * Math.random());

`  function getSomethin() {
    //
    var SomethingApiKey = r_text[nn]
    var SomethingApiCall = "https://api.website.net/catalog/" + SomethingApiKey + "/" + l + "," + l + "?units=si";
    $.ajax({
      url: SomethingApiCall,
      type: "GET",
      dataType: "jsonp",

But is not working :/




Aucun commentaire:

Enregistrer un commentaire