Echo

About

Echo is a compact library for making Ajax requests, built off of WeideMo's MiniAjax Weighing in at under 100 lines of code, Echo provides a convenient interface for Ajax requests, both GET and POST. It also provides innate JSON parsing where possible. Echo was built in order to be used as a compact and intuitive Ajax library for development on the Atheos IDE, however it's proved so valuable as to become it's own mini library. Echo returns the XMLHttpRequest in order to faciliate aborts, and encourage further customization. Only the URL is required in order to send an Echo; All other options are optional and the type defaults to POST.

Echo uses the MIT License

Download on Github

Features

Pleasently Parsed: Echo automatically tries to parse JSON replies.

Crazily Condensed: The minified version is less than ~1K, roughly 500b gzipped.

Easily Extensible: Echo is easily modifyable to meet your needs.

Usage

Argument Required Type
url true string
type false ["POST" || "GET"]
data false object
Argument Required Type
timeout false integer
success false function
failure false function
echo({
    url: "./testXhr.php",                // Destination URL
    type: "POST",                        // Request Type: POST (default) or GET
    data: { name: "WeideMo", age: 26 },  // Data sent to the server
    timeout: 5000,                       // Time in Milliseconds
    success: function (reply, httpResponseCode) {
        // Function called on success
    },
    failure: function (reply, httpResponseCode) {
        // Function called on failure
    }
});

Returns XMLHttpRequest

This is a message