let xhr = new XMLHttpRequest();
                  
                  
                              xhr.open(options.method || 'GET', url, false);
                  
                  
                              xhr.onreadystatechange = function () {
                  
                  
                                  if (xhr.status !== 200)
                  
                  
                                      console.log('Ошибка сервера: ' + this.status);
                  
                  
                              };
                  
                  
                              xhr.setRequestHeader('Content-Type', 'application/json;charset=UTF-8');
                  
                  
                              xhr.send(JSON.stringify(options.data));
                  
                  
                  
                  
                  
                              xhr.onload = function () {
                  
                  
                                  resolve('response' in xhr ? xhr.response : xhr.responseText);
                  
                  
                              }
                  
                  
                          });
                  
                  
                
gist.github.com
до появления fetch так писали ?
Обсуждают сегодня