1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
| (function(global){
'use strict';
var gEID,
ajax,
inbox,
sends,
document,
parametres,
discutions,
CallBack,
bodyProfil;
document = global.document;
ajax = function (path,params,callback){
var xhr,
response;
xhr = new XMLHttpRequest();
xhr.open("POST",path);
xhr.send(params);
xhr.onreadystatechange = function (){
if(xhr.readyState == 4 && xhr.status == 200){
response = xhr.responseText;
callback(response);
}
};
};
gEID = function(myId){
return document.getElementById(myId);
};
inbox = gEID('messages_recus');
sends = gEID('messages_envoyes');
parametres = gEID('mes_parametres');
discutions = gEID('discutions_suivies');
bodyProfil = gEID('body_profil');
CallBack = function(response){
alert(response);
bodyProfil.innerHTML = response;
}
discutions.addEventListener('click',function(){
ajax("./serveur/profil/discutions.php",null,CallBack);
},false);
inbox.addEventListener('click',function(){
ajax("./serveur/profil/recus.php",null,CallBack);
},false);
sends.addEventListener('click',function(){
ajax("./serveur/profil/envoyes.php",null,CallBack);
},false);
parametres.addEventListener('click',function(){
ajax("./serveur/profil/parametres.php",null,CallBack);
},false);
})(this);
/!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
Partager