Hmm.. It looks okay to me.
Could you define "In IE I need to wait 5-6 seconds" a little more?
Does that mean you have wait for the page to finish loading, then wait
5-6 seconds, then do any drop-down selection?
Or does it mean you do a drop-down selection, then wait 5-6 seconds
(with a setTimeout or something) before the AJAX call?

Also, what happens if you remove the 'keyup' event and try it? Just
'change' should be sufficient, I think.

On Sep 2, 10:45 pm, nubcake <unniw...@gmail.com> wrote:
> 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?

Reply via email to