[jQuery] Populating Select Boxes
Hi,
I am new to jquery and have a problem that I cannot explain. I am
trying to populate a select box with values from a database. The
select box works fine in FF, but nothing appears to happen in IE.
Below is my code. Any help on what this is caused by would be
greatly
appreciated:
HTML file:
<html>
<head>
<title>Testing AJAX and PHP</title>
<script type="text/javascript" src="../js_files/jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#sector").load("ajax-test2.php?cmd=init");
}
);
</script>
</head>
<body >
<select id="sector"></select>
<div id="content"></div>
</body>
</html>
PHP FILE:
<?php
$cmd = $_REQUEST["cmd"];
$id = $_REQUEST["id"];
$dbtype = 'mssql';
$dbcon = mssql_connect($server, $user, $password);
mssql_select_db($dbname);
if ($cmd == "init")
{
$sql = "select recordid from myTable";
$result = mssql_query($sql, $dbcon);
echo "<option value='' selected>(select a person)</option>
\n";
while ($row = mssql_fetch_array($result, MSSQL_ASSOC)) {
echo "<option value='$row[recordid]'>$row[recordid]</
option>\n";
}
}
?>
Note again that this works fine in FF (meaning that the select box is
populated), but does not work in IE.
Mike