var http2; // Notre objet XMLHttpRequest

function creerAJAX() {
    var http2;
    if(window.XMLHttpRequest)    { // Mozilla, Safari, ...
        http2 = new XMLHttpRequest();
    }
    else if(window.ActiveXObject)     { // Internet Explorer
        http2 = new ActiveXObject("Microsoft.XMLHTTP");
    }
    return http2;
}

function acheterSansBouger(produit) {
    http2 = creerAJAX();
	http2.open('get', '/?page=shop/cart&func=cartAdd&product_id='+produit, true);
	http2.onreadystatechange = nouvelleFonction();
	http2.send(null);
}

function nouvelleFonction() {
    http2 = creerAJAX();
	http2.open('get', '/combien-dans-panier.php', true);
	http2.onreadystatechange = retourAJAX();
	http2.send(null);
}

function retourAJAX() {
    if(http2.readyState == 4)     {
        if(http2.status == 200)         {
            document.getElementById('combien').innerHTML = http2.responseText;
        } else  {
            //document.getElementById('nbr_clics').innerHTML = "<strong>N/A</strong>";
        }
    }
}
// JavaScript Document