So...yeah, this is my function that calls ajax. I am trying to figure out why my $value isn't defined in my showuser.php??
function showUser2(value) {
var xhr = new XMLHttpRequest();
xhr.open("POST","showuser.php",true);
xhr.onreadystatechange = function() {
if(xhr.readyState == 4 && xhr.status == 200) {
document.getElementById('container').innerHTML = xhr.responseText;
}
}
xhr.send("value="+value);
}
showuser.php
<?php
$value = $_POST['value'];
include_once("connect.php");
$obj = new User;
echo $value;
?>
This is how I call that javascript function ajax. I tried to put alert(value) in my function showUser2() and it gives exactly what I want...
<select id="selConc" onChange='showUser2(this.value);'>
<option>Choisissez par nom:</option>
<?php $obj->unConc(); ?>
</select>