A simple JavaScript library for sending AJAX requests. Supports PUT,POST,DELETE,GET,OPTIONS,HEAD requests.
Normal: 2.26kb Minify: 1.24kb MonkeyJS: 1.04kb Gzip: 0.64kb
ajax.send({...})
async: true // Asynchronous loading (default: true)
url: "index.php" // Where to send a request
data: {param1:"value 1",param2:"value 2"} // Passed parameters
type: 'POST' // Request method (default: "GET")
dataType: "html" // Type of received data (supported json, html, xml)
success: function(result){...} // Callback function to call in case of successful transmission
error: function(){...} // Callback function to be called when an error
beforeSend: function(){...} // Callback function to call before sending the request
ajax.send({
url: "users.php",
data: {firstName:"Max",lastName:"Golubcov"},
type: "POST",
dataType: "json",
success: function(result){
console.log(result);
}
});