JSFiddle - React, Tailwind, and code Playground

by Patrick Hund

JavaScript

var datajson = ["MY JSON1", "MY_JSON2"];

var delay = 1000;

var index = 0;

var interval = setInterval(function () {
  var element = datajson[index];
    console.log(element);

  /*
  var options = {
    method: 'POST',
    url: 'http://XXX',
    headers: { XXX },
    body: { XXX },
    json: true
  };
  

  request(options, function (error, response, body) {
    if (error) throw new Error(error);
    console.log(body);
  });
  */
  
  if (++index === datajson.length) {
    clearInterval(interval);
  }
}, delay)