Voha888

Сортировка и парсинг javascript

Oct 14th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function getlist(directory) {
  2.   var xhttp = new XMLHttpRequest();
  3.   xhttp.onreadystatechange = function() {
  4.   if (this.readyState == 1) {
  5.       document.getElementById("setlist").innerHTML =
  6.       "Подождите, загружаю список файлов...";
  7.     }
  8.  
  9.  
  10.     if (this.readyState == 4 && this.status == 200) {
  11.       var data = this.responseText;
  12.       updateDataOnPage(data);
  13.     }
  14.   };
  15.   xhttp.open("GET", "getlist?listrequest="+directory, true);
  16.   xhttp.send();
  17. }
  18.  
  19. function updateDataOnPage(data) {
  20.     data = data.split(":").sort();
  21.     document.getElementById("setlist").innerHTML = data;
  22. }
Add Comment
Please, Sign In to add comment