I wrote a code that "uploads" to me the unavailable content when I press the button:

$(document).ready(function () { let trigger = $('.left-side > div > a'), container = $('.right-side'); trigger.click(function () { let $this = $(this), target = $this.data('target'); trigger.removeClass('current-tab'); $this.addClass('current-tab'); container.load(target + '.txt'); return false; }); }); 

When viewing the page inspector, I noticed that when I clicked on the buttons, my code does not look at the downloaded files on the site, but continues to load the new files:

enter image description here

How to make my code check for the presence of a file uploaded to the site and take data from it, instead of re-uploading files?

  • Add the downloaded files to the dictionary (where the key is the name of the file, the value is the content). Before loading, check the entry of the key in the dictionary. If there is - we take the data and the dictionary, no - we load it and put it in the dictionary - ArchDemon
  • @ArchDemon Can you give a sample code or link to a resource, where can I find out about it? I know JS superficially - Antonio112009 February

0