All pastes #284900 Raw Edit

Trucs

public text v1 · immutable
#284900 ·published 2006-12-19 12:11 UTC
rendered paste body
// Comment
I'd like to display in layer "hello wolrd", value who should be returned from findRdv.inc.php
When i m using alert(http.responseText); nothing happened, something wrong on my php file ?

// JS
  var D = document.getElementById(layer); 
  http.open("POST", "phpToJs/findRdv.inc.php", true);

  http.onreadystatechange = function() {
    if(http.readyState == 1){
      D.innerHTML = 'Loading...';
    }
    if(http.readyState == 4 && http.status == 200) {
      alert(http.responseText);
      var response = http.responseText;
      D.innerHTML=http.response;
    }
    http.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    http.send("toto="+toto);
  }

// PHP 
<?php
echo 'var toto = "hello world";';
?>