Ajax的get方法

UPDATE... this is the code I've implemented from the tutorial, within chrome dev tools in network i can see in header the variable is being sent and in preview i can see the drop down menu however it is not inserted into the loaded webpage

<script type="text/javascript">
$(document).ready(function() {
    $('#selectEvidence').change(function(){
        alert($(this).val());
        });
    });  

function evidencesearch(str)
{
if (str=="")
  {
  document.getElementById("case").innerHTML="";
  return;
  } 
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("case").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","searchfunction.php?variable="+str,true);
xmlhttp.send();
}       
</script>


<?php
$variable = $_GET['variable']; //used for second drop down menu
//echo "test test test $variable";

$dbhost = 'localhost';
$dbuser = 'root';
$dbpass = '';
$db = 'fid';


$conn = mysql_connect($dbhost,$dbuser,$dbpass);
if (!$conn)
die('Could not connect: ' . mysql_error());

mysql_select_db($db);

echo '<label class="input" for="case" type="input">Specify: </label><select id="case" name="case"><option=value"null"></option>'; //Insert to loaded page
$resource = mysql_query("SELECT $variable FROM `evidence`");
if($resource && mysql_num_rows($resource)) {
    while ($row = mysql_fetch_assoc($resource)){
         echo '<option value="'.$row[$variable].'">'.$row[$variable].'</option></select>';//Insert to loaded page
    }
}
mysql_close($conn)
?>

I think your problem sticks within POST/GET functions; try to call them synchronously and paste please the w3schools tutorial's link you mentioned. Maybe I can help you then by writing more detailed answer.

Cheers.