Tu je kód.
function getAjax() {
var xmlhttp;
if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
try {
xmlhttp = new XMLHttpRequest();
} catch (e) {
xmlhttp = false;
}
}
return xmlhttp;
}
function postText()
{
chatbox = document.getElementById( "mytext" );
chat = escape(chatbox.value);
chatbox.value = '';
if(chat.length == 0 ) {return; }
var params = "sprava=" + chat;
url = 'prijmi.php';
req = getAjax();
req.onreadystatechange = function(){
if( req.readyState == 4 && req.status == 200 ) {
fetch();
}
}
req.open( 'POST', url, true );
req.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
req.setRequestHeader("Content-length", params.length);
req.setRequestHeader("Connection", "close");
req.send(params);
}
A v prijmi.php to beriem ako $sprava = $_POST['sprava'];
Predom Ďakujem za Vaše odpovede.