Advertisement
daniilak

Untitled

Mar 12th, 2021
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. getJSON = function (url, sendingData, successHandler, errorHandler = null) {
  2.     let xhr = typeof XMLHttpRequest != 'undefined'
  3.       ? new XMLHttpRequest()
  4.       : new ActiveXObject('Microsoft.XMLHTTP');
  5.     xhr.open('POST', url, true);
  6.     xhr.onreadystatechange = function () {
  7.       let status;
  8.       let data;
  9.       if (xhr.readyState == 4) { // `DONE`
  10.         status = xhr.status;
  11.         if (status == 200) {
  12.           data = xhr.responseText;
  13.           successHandler && successHandler(data);
  14.         } else {
  15.           errorHandler && errorHandler(status);
  16.         }
  17.       }
  18.     };
  19.     xhr.send(sendingData);
  20. };
  21. let sendingData = new FormData();
  22. sendingData.append("pid", 0);
  23. sendingData.append("i_id", 63);
  24. sendingData.append("but", 'use');
  25. getJSON("https://league17reborn.ru/game.php?fun=fight",sendingData, data=>{location.reload()})
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement