views:

87

answers:

1

heya

I use jQuery/AJAX to send queries to MySQL. It works flawless in FF and Chrome, but in IE(7) you have to wait a couple of seconds before you change "option" in the select box. Or else no value returns. While in FF and Chrome you can do it immedadtly. countrycodes value is set, but it dont always get to query.php.

<script type="text/javascript">
function shopQuery() {
var countrycode = $("#shopcountry").val();
if (countrycode !== "") {
$.post("query.php", {queryString: countrycode}, function(data) {
  $("#shopbrand").html(data);
  $("#shopbrand").show();
});
} else {
  $("#shopbrand").hide();
 } 
}

$(document).ready(function(){
$("#shopbrand").hide();

$("#shopcountry").keyup(function() {   
shopQuery();
});

$("#shopcountry").change(function() {   
shopQuery();
});

});   
</script>

<div class="container">

<label for="shopcountry">
  <span class="label">Country:</span>
  <select id="shopcountry" name="shopcountry">
    <option value="">Choose a country</option>
    <?php
    while ($row = mysql_fetch_array($countries)) {
      echo "<option value=\"".$row['countrycode']."\">".$row['country']."</option>\n";
    }
    ?>
  </select>
</label>   

<div id="shopbrand" style="border:1px solid black;">
</div>

</div>

Hope you understand my english OK

+1  A: 

fixed it myself

Care to explain what the problem was, and how you fixed it? It might be useful for other people in the future having the same problem.
Aistina