Vanilla Javascript AJAX Function
var http_request = new XMLHttpRequest();
http_request.open("GET", "{% url 'api_categories' %}");
http_request.send(null);
http_request.onreadystatechange = function(){
var DONE = 4;
var OK = 200;
if (http_request.readyState === DONE){
if (http_request.status === OK){
console.log(http_request.responseText);
} else {
console.log("Error: " + http_request.status);
}
}
}