hey huys i have a javascript ajax function that gets the parameter "id". I want to send it via post or get to a php file that gets database info based on the "id" but i cant get the id to transfer over to the php file. here is my code
function predeployment(id){
alert(id);
x = x + 1
if (x%2)
{
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("predeployment").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("POST","predeploymentdata.php",true);
xmlhttp.send("q=id");
}
else
{
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("predeployment").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET","blank.txt",true);
xmlhttp.send();
}
}
here is the php code but i think it is good
include "connect.php";
$id=$_POST["q"];
echo $id;
//$id = 37;
$query = "SELECT * from deployment_implementor WHERE emop_id = $id";
$result = mysql_query($query);
Any help is greatly appreciated.