What is callback function in javascript
- Single Page
Posted 13 October 2012 - 07:40 AM
Posted 14 October 2012 - 06:20 AM
Posted 14 October 2012 - 07:29 AM
new Ajax.Request('http://example.com/do_it',
{
method: 'post',
onSuccess: function(transport) { // callback function (if request is successful).
window.alert("Done!"); //
}, //
onFailure: function() { // callback function
window.alert("Error!"); // if request is unsuccessful
}
});