2022-08-27 00:29:22 +02:00
|
|
|
function send_web_request(url, messageString, varString, handleResponse) {
|
2022-08-24 21:20:54 +02:00
|
|
|
// Browserkompatibles Request-Objekt erzeugen:
|
|
|
|
r = null;
|
|
|
|
|
|
|
|
if(window.XMLHttpRequest)
|
|
|
|
{
|
|
|
|
|
|
|
|
r = new XMLHttpRequest();
|
|
|
|
}
|
|
|
|
else if(window.ActiveXObject)
|
|
|
|
{
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
|
|
|
r = new ActiveXObject('Msxml2.XMLHTTP');
|
|
|
|
}
|
|
|
|
catch(e1)
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
r = new ActiveXObject('Microsoft.XMLHTTP');
|
|
|
|
}
|
|
|
|
catch(e2)
|
|
|
|
{
|
|
|
|
alert("Ein Fehler ist aufgetreten. Bitte versuchen Sie es erneut.");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Wenn Request-Objekt vorhanden, dann Anfrage senden:
|
|
|
|
if(r != null)
|
|
|
|
{
|
|
|
|
|
|
|
|
|
2022-08-27 00:29:22 +02:00
|
|
|
|
2022-08-25 13:24:11 +02:00
|
|
|
r.open('POST', url, true);
|
2022-08-24 21:20:54 +02:00
|
|
|
|
|
|
|
r.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
|
2022-08-27 00:29:22 +02:00
|
|
|
|
|
|
|
if(handleResponse != null) {
|
|
|
|
// HTTP-POST
|
|
|
|
r.onreadystatechange = function() {
|
|
|
|
if (this.readyState == 4 && this.status == 200) {
|
|
|
|
handleResponse(this.responseText);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
2022-08-24 21:20:54 +02:00
|
|
|
|
2022-08-25 13:24:11 +02:00
|
|
|
r.send(varString);
|
|
|
|
|
|
|
|
|
|
|
|
if(messageString != 'no')
|
2022-08-24 21:20:54 +02:00
|
|
|
{
|
2022-08-25 13:24:11 +02:00
|
|
|
alert(messageString);
|
2022-08-24 21:20:54 +02:00
|
|
|
}
|
|
|
|
sleep(500).then(() => {
|
|
|
|
|
|
|
|
//window.location.href = window.location.href;
|
|
|
|
//document.location.reload();
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
alert("Ein Fehler ist aufgetreten. Bitte versuchen Sie es erneut.");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|