javascript Instantiate AJAX
function AjaxRequest() { var request = null; if(typeof window.XMLHttpRequest != "undefined") { request = new XMLHttpRequest(); } else if(typeof window.ActiveXObject != "undefined") { try { request = new ActiveXObject("Microsoft.XMLHTTP"); } catch(err) { request = null; } } return request; }
This code first tests for a native object, which most modern browsers use, then for an ActiveX implementation to support IE6. Thanks to Sitepoint Tech Times email.
Updated: Tuesday 5th October 2010, 11:52pm
There are 0 comments
Comments are currently closed.