DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

XMLHttpRequest Do Petition

04.21.2005
| 2799 views |
  • submit to reddit
        
function loadXMLDoc(url) {
		
    // branch for native XMLHttpRequest object
    if (window.XMLHttpRequest) {
    
        req = new XMLHttpRequest();
        //function_name is the function to process request
        req.onreadystatechange = function_name;
        req.open("GET", url, true);
        req.send(null);
        
    // branch for IE/Windows ActiveX version
    } else if (window.ActiveXObject) {
    
        req = new ActiveXObject("Microsoft.XMLHTTP");
        if (req) {

            //function_name is the function to process request        
            req.onreadystatechange = actualizarLista;
            req.open("GET", url, true);
            req.send();
        }
    }
}