function leggiCookie(cname) { $.ajax({ type: "POST", url: "leggisession.php", data: "nome=" + cname+"&tipo=leggi", dataType: "html", success: function(risposta) { if(risposta.length>0){ return risposta; }else{ return ""; } } }); } function creaCookie(name,value,days) { //Formatto il testo var contenuto = sostituiscitutti(";","###puntovirgola###",value); contenuto = sostituiscitutti("&","###simboloecommerciale###",contenuto); $.ajax({ type: "POST", url: "leggisession.php", data: "nome=" + name+"&valore=" + contenuto+"&tipo=scrivi", dataType: "html", async: false, cache: false, success: function(risposta) { } }); } function eliminaCookie(name) { $.ajax({ type: "POST", url: "leggisession.php", data: "nome=" + name+"&tipo=elimina", dataType: "html", async: false, cache: false, success: function(risposta) { } }); } function sostituiscitutti(searchStr, replaceStr,testo) { var str=""; for (var i = 0; i < testo.length; i++) { str=str+testo.charAt(i).replace(searchStr,replaceStr); } return str; }