How to Define Variable in jquery from PHP
<p>I am able to pass the server name to PHP which runs the query successfully.  In the html file I want the rating option to change depending on what value was returned from the PHP file.  In my file I set it to D but I need to change that to relflect what is being returned from PHP.</p>

<p>server.html</p>

<pre><code>&lt;html&gt;
    &lt;head&gt;
        &lt;script type="text/javascript" src="http://code.jquery.com/jquery-1.8.3.min.js"&gt;&lt;/script&gt;
        &lt;script type="text/javascript" &gt;
        $(document).ready(function(){
            var id = $('#existingserver').val();            
            $('#assetCenter').click(function(){
                var id = $('#textfield').val();
                $.get('servertest.php',{q:id}, function(htmlData){
                    $('#txtHint').html(htmlData);
                    var rating = $(htmlData).find("td[data-col=rating]").text();
                    alert(rating);
                    });
            });
        });

        &lt;/script&gt;
    &lt;/head&gt;
    &lt;body&gt;
        &lt;form&gt;
            &lt;label&gt;Existing Server&lt;/label&gt;&lt;input type="text" name="existingserver" id="textfield" maxlength="15"/&gt;

            &lt;input type="checkbox" id="assetCenter" &gt;Select to Pull Asset Center Data&lt;br&gt;
            &lt;br /&gt;
            &lt;br /&gt;
            Rating
            &lt;select name="rating" id="rating" &gt;
                &lt;option value="A"&gt;A&lt;/option&gt;
                &lt;option value="B"&gt;B&lt;/option&gt;
                &lt;option value="C"&gt;C&lt;/option&gt;
                &lt;option value="D"&gt;D&lt;/option&gt;
            &lt;/select&gt;
        &lt;/form&gt;
        &lt;br /&gt;

        &lt;div id="txtHint"&gt;&lt;b&gt;Server info will be listed here.&lt;/b&gt;&lt;/div&gt;
    &lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>servertest.php</p>

<pre><code>&lt;?php
$q=$_GET["q"];

$con = mysql_connect('localhost', 'assignip', 'assignip');
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("ipreservation", $con);

$sql="SELECT * FROM acdata WHERE servername = '".$q."'";

$result = mysql_query($sql);

echo "&lt;table border='1'&gt;
&lt;tr&gt;
&lt;th&gt;Servername&lt;/th&gt;
&lt;th&gt;Contact&lt;/th&gt;
&lt;th&gt;Classification&lt;/th&gt;
&lt;th&gt;Rating&lt;/th&gt;
&lt;/tr&gt;";

while($row = mysql_fetch_array($result))
  {
  echo "&lt;tr&gt;";
  echo "&lt;td&gt;" . $row['servername'] . "&lt;/td&gt;";
  echo "&lt;td&gt;" . $row['contact'] . "&lt;/td&gt;";
  echo "&lt;td&gt;" . $row['classification'] . "&lt;/td&gt;";
  echo "&lt;td&gt;" . $row['rating'] . "&lt;/td&gt;";
  echo "&lt;/tr&gt;";
  echo "&lt;td data-col='rating'&gt;" . $row['rating'] . "&lt;/td&gt;";
  }

  echo "&lt;/table&gt;";

mysql_close($con);
?&gt; 
</code></pre>

<p>database fields: servername, contact, classification, rating
Data: Server1, Ray, Production, A </p>
