Skip to content

Instantly share code, notes, and snippets.

@dannygarcia
Created September 17, 2012 01:32
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save dannygarcia/3735115 to your computer and use it in GitHub Desktop.
Save dannygarcia/3735115 to your computer and use it in GitHub Desktop.
test js syntax highlight
// Simple ajax function to avoid using jQuery (°-°)
var ajax = function (url, callback) {
var xhr = new XMLHttpRequest();
xhr.open('GET', url, true);
xhr.send();
xhr.onreadystatechange = function (e) {
if (e.target.status === 200 && e.target.readyState === 4) {
callback(e.target.response);
}
};
};
// Example
ajax("http://news.ycombinator.com/", function (data) {
console.log(data);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment