Delta’s AJAX JavaScript

This JavaScript provides an easy way to integrate AJAX in to any web project. It has no requirements and can be used without any external extensions such as JQuery, etc.

License: MIT


The first parameter taken by the ajax.send method is ether POST or GET depending on the intention of the form to handle data.
In this example the next two variables are passed as an array to the function send. The first being a value taken from the input ‘name’. This is done by including the ‘#’ symbol, which tells the script to get the value from the element with the id ‘name’, where as in the case of ‘foo’ no hash has been specified which tells the script that the variable is just ‘bar’ and no elements are involved.
The next parameter represents the function to be executed upon completion of the script. This parameter can be null or the name of a JavaScript function. In this case the function called is ‘updateStatus’.
Finally the last parameter is the AJAX sync parameter which can be true or false depending on if you intend to use asynchronous methods.

<script src="delta-ajax-1.0.min.js"></script>

     Name: <input id="name" type="textbox" />
     <button onclick="ajax.send(‘POST’, {name:’#name’, foo:’bar’}, updateStatus, true">Send Name</button>

<div id="status"></div>

     function updateStatus(data) {
          document.getEmlementByID(‘status’).innerHTML = data;

Download (includes full and minified versions): Delta's AJAX JavaScript (28)