function scriviCookie(nomeCookie,valoreCookie,durataCookie) { var scadenza = new Date(); var adesso = new Date(); scadenza.setTime(adesso.getTime() + (parseInt(durataCookie) * 60000)); document.cookie = nomeCookie + '=' + escape(valoreCookie) + '; expires=' + scadenza.toGMTString() + '; path=/'; console.log("cookie"); } function richiesta_ajax() { var isChecked_preferenze = isChecked_marketing = isChecked_statistiche = 0; if(document.getElementById('clion_preferenze').checked){ //checked isChecked_preferenze = 1; } if(document.getElementById('clion_marketing').checked){ //checked isChecked_marketing = 1; } if(document.getElementById('clion_statistiche').checked){ //checked isChecked_statistiche = 1; } scriviCookie( 'clion_cookie' ,isChecked_preferenze+'-'+isChecked_statistiche+'-'+isChecked_marketing,43200); var xmlhttp = new XMLHttpRequest(); xmlhttp.withCredentials = true; xmlhttp.onreadystatechange = function() { if (xmlhttp.readyState == XMLHttpRequest.DONE) { // XMLHttpRequest.DONE == 4 if (xmlhttp.status == 200) { console.log("fatto"); document.getElementById('frame_cookie').contentWindow.location.reload(true); } else if (xmlhttp.status == 400) { console.log("errore"); } else { alert('something else other than 200 was returned'); } } }; //xmlhttp.open("GET", "https://www.chatpersiti.it/clion_cookie.php?preferenze="+isChecked_preferenze+"&marketing="+isChecked_marketing+"&statistiche="+isChecked_statistiche+"&id=48753d4ebd83ec04e3dbdbfe1afb25e0" , true); //xmlhttp.open("GET", "clion_cookie.php?preferenze="+isChecked_preferenze+"&marketing="+isChecked_marketing+"&statistiche="+isChecked_statistiche+"&id=48753d4ebd83ec04e3dbdbfe1afb25e0" , true); //xmlhttp.send(); } if (document.cookie.length > 0) { var inizio = document.cookie.indexOf( "48753d4ebd83ec04e3dbdbfe1afb25e0" + "="); var inizio_gdpr = document.cookie.indexOf( "clion_cookie" + "="); if ((inizio != -1)||(inizio_gdpr != -1)) { }else{ scriviCookie( '48753d4ebd83ec04e3dbdbfe1afb25e0' ,'visitato',43200); document.write(''); } }else{ scriviCookie( '48753d4ebd83ec04e3dbdbfe1afb25e0' ,'visitato',43200); document.write(''); }