code: function _send(level, args) {
    var payload = (
      'level=' + encodeURIComponent(level) +
      '&message=' + encodeURIComponent(args.join(' ')));
  
    var xhr = new XMLHttpRequest();
    xhr.open('POST', '/log');
    xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
    xhr.onreadystatechange = function () {
      // Check for error state
      if (xhr.readyState === 4 && xhr.status !== 200) {
        // TODO: Notify user on the page and show message if console.log doesn't exist
        if (console && console.log) {
          console.log(xhr.responseText);
        }
      }
    };
    xhr.send(payload);
  }
docs: http://stackoverflow.com/questions/6418220/javascript-send-json-object-with-ajax http://stackoverflow.com/questions/9713058/sending-post-data-with-a-xmlhttprequest http://stackoverflow.com/questions/332872/encode-url-in-javascript