AjaxRequest.get( { 'onSuccess':function(req){ document.forms['simple'].pageSource.value = req.responseText; } } );
AjaxRequest.get( { 'url':'junk.html' ,'onSuccess':function(req){ alert('Success!'); } ,'onError':function(req){ alert('Error!\nStatusText='+req.statusText+'\nContents='+req.responseText);} } );
AjaxRequest.get( { 'url':'sleep.pl' ,'onSuccess':function(){ alert('Success!'); } ,'timeout':2000 ,'onTimeout':function(req){ alert('Timed Out!'); } } );
function getResponse(target) { AjaxRequest.get( { 'url':'sleep.pl' ,'onSuccess':function(req){ target.value=req.responseText; } } ); }
// Simple functions to update the page function makeActive(o) { o.innerHTML = "Active"; o.style.backgroundColor = "#00ff00"; } function makeInactive(o) { o.innerHTML = "Inactive"; o.style.backgroundColor = "#ff0000"; } // Functions called by global begin/end function AjaxRequestBegin() { makeActive(document.getElementById('ajaxActivity')); } function AjaxRequestEnd() { makeInactive(document.getElementById('ajaxActivity')); } // Functions called by group begin/end function AjaxRequestGroupBegin(groupName) { makeActive(document.getElementById(groupName+"Activity")); } function AjaxRequestGroupEnd(groupName) { makeInactive(document.getElementById(groupName+"Activity")); } function getResponse2(target,groupName) { AjaxRequest.get( { 'url':'sleep.pl' ,'onSuccess':function(req){ target.value=req.responseText; } ,'groupName':groupName // Assigns this request to the group passed in ,'onGroupBegin':AjaxRequestGroupBegin // Map to the function called when this group starts ,'onGroupEnd':AjaxRequestGroupEnd // Map to the function called when this group ends } ); }
function submitForm(theform) { var status = AjaxRequest.submit( theform ,{ 'onSuccess':function(req){ document.forms['form2'].submitResults.value = req.responseText; } } ); return status; }
AjaxRequest.get( { 'onLoading':function() { alert("Loading"); } ,'onLoaded':function() { alert("Loaded"); } ,'onInteractive':function() { alert("Interactive"); } ,'onComplete':function() { alert("Complete"); } ,'onSuccess':function() { alert("Success"); } } );
function getQueuedResponse(target) { AjaxRequest.get( { 'url':'sleeplong.pl' ,'onLoading':function(req){ target.value=req.xmlHttpRequest.readyState; } ,'onLoaded':function(req){ target.value=req.xmlHttpRequest.readyState; } ,'onInteractive':function(req){ target.value=req.xmlHttpRequest.readyState; } ,'onSuccess':function(req){ target.value=req.xmlHttpRequest.readyState; } } ); }
AjaxRequest.get( { 'parameters':{ 'a':'1', 'b':'2', 'c':'3' } ,'anotherParameter':'true' ,'onSuccess':function(req) { document.forms["parameterForm"].exampleUrl.value = req.url; } } );