[jQuery] AJAX-queries in Internet Explorer
Hello!
I've having troubles in Internet Explorer with AJAX-queries using
jQuery.
When I change 'option', located in the below code, in FF/Chrome the
$.post is sent almost instantly.
In IE I need to wait 5-6 seconds otherwise the $.post will not be sent
to query.php.
Is there any solution to this? I've experienced it in both IE7 and
IE8.
<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>
Do you have any ideas what's going wrong?