Ajax recursive call


Hi all,

I’m developing a new package and am trying to perform several AJAX calls to a website, in order to fetch relevant JSON regarding several subjects.
Unfortunately I am encountering HTTP Error 429, due the large amount of calls I am processing in a short time. My plan to resolve this was to make the process wait an a certain amount of time before trying again.

    $.ajax({url: url_path,
        type: "GET",
        success: function(data, status, xhr) {
          // do something
        error: function(xhr, status) {
          if (xhr['status'] == 429){
            setTimeout(console.log('error: ' + url_path), 4000);


However the AJAX call crashes as it can not find itself as a function.
Any idea of how to make an AJAX call recursive within a package .js file.