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 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
   |  
<html>
<head>
<script type="text/javascript">
var xmlhttp;
function loadXMLDocGet(url)
{
xmlhttp=null;
if (window.XMLHttpRequest)
  {// code for Firefox, Mozilla, IE7, etc.
  xmlhttp=new XMLHttpRequest();
  }
else if (window.ActiveXObject)
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
if (xmlhttp!=null)
  {
  xmlhttp.onreadystatechange=state_Change;
  xmlhttp.open("GET",url,true);
  xmlhttp.send(null);
  }
else
  {
  alert("Your browser does not support XMLHTTP.");
  }
}
 
 
function loadXMLDocPost(url)
{
xmlhttp=null;
if (window.XMLHttpRequest)
  {// code for Firefox, Mozilla, IE7, etc.
  xmlhttp=new XMLHttpRequest();
  }
else if (window.ActiveXObject)
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
if (xmlhttp!=null)
  {
  xmlhttp.onreadystatechange=state_Change;
  xmlhttp.open("POST",url,true);
  xmlhttp.send("clef=valeur");
  }
else
  {
  alert("Your browser does not support XMLHTTP.");
  }
}
 
function state_Change()
{
if (xmlhttp.readyState==4)
  {// 4 = "loaded"
  if (xmlhttp.status==200)
    {// 200 = "OK"
      document.myform.test.value="connexion ok";
      document.myform.codereponse.value=xmlhttp.status;
      document.myform.txtreponse.value=xmlhttp.responseText;
    }
  else
    {
    alert("Problem retrieving data:" + xmlhttp.statusText);
    document.myform.test.value="connexion problem";
    document.myform.codereponse.value=xmlhttp.status;
    document.myform.txtreponse.value=xmlhttp.responseText;
    }
  }
}
 
</script>
</head>
<body>
<input type="button" value="fermer" onClick="fermer()"> <br>
<form name="myform">
<button onclick="loadXMLDocGet('http://xx.x.x.x.x/pagesecurisee.htm')">Connexion page securisee</button>
<input type="button" value="Connexion formulaire" onclick="loadXMLDocPost('adresse_a_laquelle_envoi_le_form')">
<input type="text" name="test">
code reponse :
<input type="text" name="codereponse"><br>
texte reponse :
<TEXTAREA name="txtreponse" rows=32 cols=100></TEXTAREA>
</form>
</body>
</html> | 
Partager