Klasse, Funktioniert gut, sehr gut, danke. ich habe zwar in google gesucht, leider wusste ich nicht genau, wonach ich suchen sollte. aber vielen dank für deine Hilfe.
Für die jenigen, die ein ähnliches problem haben, hier die veränderte version :
function AjaxRequest (url, params)
{
var thisObject=this;
this.url = url;
this.is_async=params.is_async;
this.method = (params.method)?params.method.toUpperCase():"GET";
this.parameter = (params.parameter)?params.parameter:null;
if (params.onSuccess)
this.onSuccess=params.onSuccess;
else {
alert("Keine onSuccess Ereignissfunktion angegeben.\n\nBitte geben Sie einen Funktion an, die beim onSuccess ausgeführt.");
return false;
}
this.onWaiting=(params.onWaiting)?params.onWaiting:this.onSuccess;
this.onFailure=(params.onFailure)?params.onFailure:this.onSuccess;
this.anfrage=null;
try {
this.anfrage=new XMLHttpRequest();
} catch(versuchmicrosoft) {
try {
this.anfrage=new ActiveXObject("Msxml2.XMLHTTP");
}catch(anderesmicrosoft) {
try {
this.anfrage=new ActiveXObject("Microsoft.XMLHTTP");
} catch(fehlschlag) {
this.anfrage=null;
}
}
}
if (!this.anfrage) {
alert ("Das Anfrageobjekt konnte nicht initialisiert werden.\n\nBitte versuchen Sie es mit einen Anderen Browser.");
return false;
}
this.checkState = function() {
if (this.readyState==2) {
thisObject.onWaiting();
} else if (this.readyState==4 && this.status==200) {
thisObject.onSuccess();
} else if (this.readyState==4 && this.status!=200) {
thisObject.onFailure();
}
}
this.sendRequest = function() {
var parameter=this.parameter;
if (this.method=="GET"){
this.anfrage.open("GET",this.is_async,this.url + "?" + parameter);
this.anfrage.onreadystatechange = this.checkState;
this.anfrage.send(null);
}
};
}
var anfrage = new AjaxRequest("http://localhost/kapitel01/boards/aktuelleBoardVerkaeufe.php",{
method:"GET",
parameter:"wort=test",
is_async: true,
onWaiting:test,
onSuccess:test,
onFailure:test
});
function test() {alert ("test");}
anfrage.sendRequest();
und nochmals danke für die rasche antwort.