function ajax(method, url, data, success, error) {
    var xhr = new XMLHttpRequest();
    xhr.open(method, url);
    xhr.setRequestHeader("Accept", "application/json");
    xhr.onreadystatechange = function () {
      if (xhr.readyState !== XMLHttpRequest.DONE) return;
      if (xhr.status === 200) {
        success(xhr.response, xhr.responseType);
      } else {
        error(xhr.status, xhr.response, xhr.responseType);
      }
    };
    xhr.send(data);
  }
// helper function for sending an AJAX request
helper function for sending an AJAX request
helper function for sending an AJAX request
function ajax(method, url, data, success, error) {
    var xhr = new XMLHttpRequest();
    xhr.open(method, url);
    xhr.setRequestHeader("Accept", "application/json");
    xhr.onreadystatechange = function () {
      if (xhr.readyState !== XMLHttpRequest.DONE) return;
      if (xhr.status === 200) {
        success(xhr.response, xhr.responseType);
      } else {
        error(xhr.status, xhr.response, xhr.responseType);
      }
    };
    xhr.send(data);
  }
function ajax ( method , url , data , success , error ) { var xhr = new XMLHttpRequest ( ) ; xhr . open ( method , url ) ; xhr . setRequestHeader ( "Accept" , "application/json" ) ; xhr . onreadystatechange = function ( ) { if ( xhr . readyState !== XMLHttpRequest . DONE ) return ; if ( xhr . status === 200 ) { success ( xhr . response , xhr . responseType ) ; } else { error ( xhr . status , xhr . response , xhr . responseType ) ; } } ; xhr . send ( data ) ; }
helper function for sending an AJAX request
helper function for sending an AJAX request