2

My code hangs Chrome and Safari for about 3sec. Firefox works perfectly. How can i set this in async: true -state? Or is my only option preload all pages in divs and hide them when entering to site?

$(document).ready(function() {
  $("#Button").click(function(evt) {
$('#change').html('<p><img src="ajax-loader.gif" width="15" height="15" /></p>');
 $("#change").load('reg.php')
    })    
});
Jarno
  • 139
  • 1
  • 13
  • 2
    .load is async: true by default. If you set async: false globally, the only way to change would be to set it to true globally, or to use $.ajax instead. – Kevin B Jul 10 '13 at 20:42
  • Check the jQuery Manual: [jQuery.ajax()](http://api.jquery.com/jQuery.ajax/) and [this answer](http://stackoverflow.com/a/6685294/2493918). – Markus Hofmann Jul 10 '13 at 20:45
  • I have changed to this but it still hangs? $.ajaxSetup({ async: true }); $(document).ready(function() { $("#Button").click(function(evt) { $('#vaihtuva').html('

    '); $.ajax({ url: "reg.php", cache: false, async: true }).done(function( html ) { $("#change").html(html); }) }) });
    – Jarno Jul 11 '13 at 04:16

0 Answers0