What's a Jelo Shot? How do I use these tutorials?

Tutorial: Make an AJAX Request

Simple GET request

Jelo.Ajax.request({
    url     : "currentTemperature.php",
    success : function() {
        $(".example").innerHTML = this.responseText;
    }
});
Run the Jelo Shot above to make a simple AJAX call.

Passing data to PHP with POST 

// not PHP-specific, this works with any server language
Jelo.Ajax.request({
    url     : "currentTemperature.php",
    method  : "POST",
    data    : {
        zipCode: 92260
    },
    success : function() {
        $(".example").innerHTML = this.responseText;
    }
});
Run the Jelo Shot above to get the temperature in zip code 92260...

What happens when a call fails?

Jelo.Ajax.request({
    url     : "/no-page-here.html",
    success : function() {
        alert("Success!");
    },
    failure : function() {
        var statusCode = "HTTP status code: " + this.status;
        alert("AJAX call failed! " + statusCode);
    }
});
Run the Jelo Shot above to call a page that doesn't exist.

See the Jelo API for complete details.