function getHTTPObject() { var xmlhttp = false; /* Compilation conditionnelle d'IE */ /*@cc_on @if (@_jscript_version >= 5) try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (E) { xmlhttp = false; } } @else xmlhttp = false; @end @*/ /* on essaie de créer l'objet si ce n'est pas déjà fait */ if (!xmlhttp && typeof XMLHttpRequest != 'undefined') { try { xmlhttp = new XMLHttpRequest(); } catch (e) { xmlhttp = false; } } if (xmlhttp) { /* on définit ce qui doit se passer quand la page répondra */ xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState == 4) /* 4 : état "complete" */ { if (xmlhttp.status == 200) /* 200 : code HTTP pour OK */ { /* Traitement de la réponse. */ //alert(xmlhttp.responseText); eval(xmlhttp.responseText); } } } } return xmlhttp; } window.onload = function() { //on associe la fonction verifId à l'événénement onsubmit du formulaire //document.getElementById('main').onclick = HttpGet; } function HttpGet(step) { document.getElementById('main').innerHTML = '
'; //envoi des données return !sendData( 'POST', 'http://appelgagnant.eurower.com/online/xmlhttp.php', 'doAction=' + step); } function HttpPostPay(code) { document.getElementById('main').innerHTML = '
'; //envoi des données return !sendData( 'POST', 'http://appelgagnant.eurower.com/online/xmlhttp.php', 'doAction=pay&code=' + code); } /** * Envoie des données à l'aide d'XmlHttpRequest? * @param string methode d'envoi ['GET'|'POST'] * @param string url * @param string données à envoyer sous la forme var1=value1&var2=value2... */ function sendData(method, url, data) { var xmlhttp = getHTTPObject(); if (!xmlhttp) { return false; } if(method == "GET") { if(data == 'null') { xmlhttp.open("GET", url, true); //ouverture asynchrone } else { xmlhttp.open("GET", url+"?"+data, true); } xmlhttp.send(null); } else if(method == "POST") { xmlhttp.open("POST", url, true); //ouverture asynchrone xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); xmlhttp.send(data); } return true; } HttpGet('step0');