function creationXHR() {
	var resultat;
	try {
		resultat = new XMLHttpRequest();
	}
	catch (Error) {
		try {
			resultat = new ActiveXObject("Msxml12.XMLHTTP");
		}
		catch (Error) {
			try {
				resultat = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch(Error) {
				resultat = null;
			}
		}
	}
	return resultat;
}

function addConstante(idConstante, idUtilisateur) {
        objetXHR = creationXHR();
        objetXHR.open("get", "AjaxLeeds/addConstantePanier.php?id=" + idConstante+"&idUtilisateur="+idUtilisateur,true);
        objetXHR.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
        objetXHR.onreadystatechange= function actualiserPage() {
            if (objetXHR.readyState == 4) {
                if (objetXHR.status == 200) {
                        var res=objetXHR.responseText;
                        if (res=="ok")
                            alert("Rate constant added");
                }
                else {
                        objetXHR.abort();
                        objetXHR = null;
                }
            }
        }
        objetXHR.send(null);
}
