//sparkl javascript library //February 2008 //original code Neil J Anderson //rubbish about: http://neilanderson.freehostia.com/ //version 0.1 //ajax module /* DOCUMENTATION doesn't require sparkl so may declare the namespace nja - 2008-02-06 */ /* TO DO / REVISION HISTORY * timer for timing out requests * queue for queueing requests * it should probably have its own DOM insertion to show that a request is being used. */ //AJAX MODULE //xmlhttprequest /* MODULE * sparkl.ajax PROPERTIES * timeout -- when to cancel a request defaults to 1000 - 1 second PRIVATE METHODS * _request -- the method used to get a request * parse -- parse an object to paired string CLASS xhr xhr PUBLIC METHODS * get -- a new get request * post -- a new post request */ //namespace var sparkl = sparkl || {}; sparkl.ajax = {};//xmlhttprequest //PRIVATE METHODS //factory to store the request to use sparkl.ajax._request = (function(){ var factories = [ function(){return new XMLHttpRequest();}, function(){return new ActiveXObject('Msxml2.XMLHTTP');}, function(){return new ActiveXObject('Microsoft.XMLHTTP');} ]; for(var i=0; i