title: GET and XMLHttpRequest
body: <p>i have an XMLHttpRequest.The request passes a parameter to my php server code in /var/www. But i cannot seem to be able to extract the parameter back at the server side. below i have pasted both the codes:</p>
  
  <p>javascript:</p>
  
  <pre><code>function getUsers(u)
  { 
   alert(u);//here u is 'http://start.ubuntu.com/9.10'
   xmlhttp=new XMLHttpRequest();
   var url="http://localhost/servercode.php"+"?q="+u;
  
   xmlhttp.onreadystatechange= useHttpResponse;
   xmlhttp.open("GET",url,true);
   xmlhttp.send(null);
  }
  
  function useHttpResponse() 
  {
  
   if (xmlhttp.readyState==4 )
   {
   var response = eval('('+xmlhttp.responseText+')');
    for(i=0;i&lt;response.Users.length;i++)
          alert(response.Users[i].UserId);
  
   }
  }
  </code></pre>
  
  <p>servercode.php:</p>
  
  <pre><code> &lt;?php
  $q=$_GET["q"];
  //$q="http://start.ubuntu.com/9.10";
  $con=mysql_connect("localhost","root","blaze");
  if(!$con)
  {die('could not connect to database'.mysql.error());
  }
  mysql_select_db("BLAZE",$con) or die("No such Db");
  $result=mysql_query("SELECT * FROM USERURL WHERE URL='$q'");
  
   if($result == null)
   echo 'nobody online';
   else
    {
    header('Content-type: text/html');
    echo "{\"Users\":[";
    while($row=mysql_fetch_array($result))
    {
     echo '{"UserId":"'.$row[UsrID].'"},';
    }
    echo "]}";
    }
  mysql_close($con);
  ?&gt; 
  </code></pre>
  
  <p>this is not giving the required result...although the commented statement , where the variable is assigned explicitly the value of the argument works...it alerts me the required output...but somehow the GET method's parameter is not reaching my php or thats how i think it is....pls help....</p>