Siri: & AJAX - request in externer .js

Beitrag lesen

Ist doch klar, weil wieder asynchron gearbeitet wird.

Ja, hast Recht! In dem Fall:

function xyz() {  
  
  
        try {  
                var http = null;  
  
                if (window.XMLHttpRequest) {  
                        http = new XMLHttpRequest();  
                } else if (window.ActiveXObject) {  
                        http = new ActiveXObject("Microsoft.XMLHTTP");  
                }  
  
                if (http != null) {  
                        http.open("GET", "example.html", true);  
                        http.onreadystatechange = function () {  
                                if (http.readyState == 4) {  
                                        callBack(http.responseText)  
;  
  
                                }  
                        }  
                        http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');  
                        http.send();  
                }  
  
        } catch(e) {  
  
        }  
  
       ;  
}  
  
function callBack(text) {  
   alert(text);  
}