A
Anonyme
Invité
Bloc de code:
function relevMess () {
if (window.XMLHttpRequest) xhr = new XMLHttpRequest();
else if (window.ActiveXObject) xhr = new ActiveXObject("Microsoft.XMLHTTP");
else alert("AJAX n'est pas présent");
xhr.onreadystatechange = function () {
if ((xhr.readyState == 4) && (xhr.status == 200)) {
var xmlRep = xhr.responseXML;
if (xmlRep.getElementsByTagName('NOMORE').length != 1) {
lastTimeRelev = parseInt(xmlRep.getElementsByTagName('LASTIME').innerText);
tabMess = xmlRep.getElementsByTagName('MESSAGE');
for (var i = 0; i < tabMess.length; i++) {
var messageOther = $('<div/>').attr('class', 'divMessageOther');
var pseudo = tabMess.getElementsByTagName('PSEUDO')[0].innerText;
var dateMess = tabMess.getElementsByTagName('TIME')[0].innerText;
messageOther.append($("<p class='entetemess'>" + pseudo + " à " + dateMess + "<p>"));
divDiscut.append(messageOther);
}
}
}
}
xhr.open('GET', 'PHP_ajax.php?t=' + tokenV + '&opp_ajax=tchatRecup&lastime=' + lastTimeRelev, true);
xhr.send(null);
setTimeout(relevMess, 2000);
}
Bloc de code:
var pseudo = tabMess.getElementsByTagName('PSEUDO')[0].innerText;var dateMess = tabMess.getElementsByTagName('TIME')[0].innerText;
Merci d'avance