/** * @author francesco */ function specialChars(str) { var stringa = new String(str); stringa = stringa.replace(/&/g, "[EC]"); stringa = stringa.replace(/:/g, "[DP]"); stringa = stringa.replace(/\+/g, "[P]"); stringa = stringa.replace(/\*/g, "[AS]"); stringa = stringa.replace(/%/g, "[MD]"); return stringa; } function createXMLHttpRequest() { var xmlhttp = false; try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (oldIE) { try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (notIE) { xmlhttp = false; } } if (!xmlhttp && typeof XMLHttpRequest != undefined) { xmlhttp = new XMLHttpRequest(); } return xmlhttp; } function makeRequest(sPage, fTarget, sMethod, str) { xmlhttp = createXMLHttpRequest(); if (sMethod == "GET") { xmlhttp.open(sMethod, sPage); xmlhttp.onreadystatechange = function() { fTarget(xmlhttp); } xmlhttp.send(null); } else if (sMethod == "POST") { xmlhttp.open(sMethod, sPage, true); xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8"); xmlhttp.onreadystatechange = function() { fTarget(xmlhttp); } xmlhttp.send(str); } else { throw new Error("Metodo per scambio dati non riconosciuto."); } }