lib/bespoke-markdown.js
function(path, callbackSuccess, callbackError) {
  var xhr = new XMLHttpRequest();
  xhr.onreadystatechange = function() {
    if (xhr.readyState === 4) {
      if (xhr.status >= 200 && xhr.status < 300) {
        callbackSuccess(xhr.responseText);
      } else {
        callbackError();
      }
    }
  };
  xhr.open('GET', path, false);
  try {
    xhr.send();
  } catch (e) {
    callbackError();
  }
}
function(path, callbackSuccess, callbackError) {
  var xhr = new XMLHttpRequest();
  xhr.onreadystatechange = function() {
    if (xhr.readyState === 4) {
      if (xhr.status >= 200 && xhr.status < 300) {
        callbackSuccess(xhr.responseText);
      } else {
        callbackError();
      }
    }
  };
  xhr.open('GET', path, false);
  try {
    xhr.send();
  } catch (e) {
    callbackError();
  }
}
function ( path , callbackSuccess , callbackError ) { var xhr = new XMLHttpRequest ( ) ; xhr . onreadystatechange = function ( ) { if ( xhr . readyState === 4 ) { if ( xhr . status >= 200 && xhr . status < 300 ) { callbackSuccess ( xhr . responseText ) ; } else { callbackError ( ) ; } } } ; xhr . open ( 'GET' , path , false ) ; try { xhr . send ( ) ; } catch ( e ) { callbackError ( ) ; } }
Fetches the content of a file through AJAX.
@param {string} path the path of the file to fetch
@param {Function} callbackSuccess
@param {Function} callbackError
Fetches the content of a file through AJAX .