1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
| function xhr()
{
var xmlHttp = null;
if(window.XMLHttpRequest)
xmlHttp = new XMLHttpRequest();
else if(window.ActiveXObject)
{
try
{
xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
}
else {
alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest...");
xmlHttp = false;
}
return xmlHttp
}
function validation()
{
var xmlHttp = xhr();
var reponse3 = document.getElementById('reponse3');
var str = document.getElementById('liste_sous_activite').options[document.getElementById('liste_sous_activite').selectedIndex].value;
var a = str.split(',');
var sous_activite = a[1];
var couleur = document.getElementById('hexval').value;
var btn_valider = document.getElementById('valider').value;
if(btn_valider != "") {
var url = "./parametre/ajax/validation.php?";
var data = "param="+sous_activite;
var data2 = ","+couleur;
url +=data+data2;
xmlHttp.open("get",url,true);
xmlHttp.onreadystatechange=function()
{
if(xmlHttp.readyState==4 && xmlHttp.status==200)
{
reponse3.innerHTML = xmlHttp.responseText;
}
}
xmlHttp.send(null);
}
} |
Partager