Search and Top Navigation
#3652 closed bug (notabug)
Opened December 09, 2008 04:51PM UTC
Closed December 12, 2008 03:01AM UTC
Last modified October 11, 2012 09:15PM UTC
Troubles with synchronous AJAX and ui.dialog in IE7
| Reported by: | hyperion | Owned by: | |
|---|---|---|---|
| Priority: | major | Milestone: | |
| Component: | ui.dialog | Version: | 1.5.2 |
| Keywords: | AJAX IE7 | Cc: | |
| Blocked by: | Blocking: |
Description
Dialog not shown in IE7 when you use AJAX in synchronous mode (async: false). In FF 3 all ok.
HTML:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script>
jQuery(document).ready(function(){
jQuery("#example").dialog({
autoOpen: false,
modal: true,
height: 50,
width: 400,
resizable: false,
draggable: false,
overlay: {
opacity: 0.5,
background: "black"
}
});
});
function doAjax() {
// lock screen
jQuery("#example").dialog( "open" );
var html = jQuery.ajax({
type: 'POST',
url: '/cgi-bin/test.pl',
async: false,
dataType: "html",
cache: false,
complete: function(obj, textStatus){
// unlock screen after load
jQuery("#example").dialog( "close" );
}
}).responseText;
jQuery("#content").html(html);
}
</script>
</head>
<body>
<link rel="stylesheet" href="http://dev.jquery.com/view/tags/ui/latest/themes/flora/flora.all.css" type="text/css" media="screen" title="Flora (Default)">
<script type="text/javascript" src="http://dev.jquery.com/view/tags/ui/latest/ui/ui.core.js"></script>
<script type="text/javascript" src="http://dev.jquery.com/view/tags/ui/latest/ui/ui.dialog.js"></script>
<script type="text/javascript" src="http://dev.jquery.com/view/tags/ui/latest/ui/ui.resizable.js"></script>
<script type="text/javascript" src="http://dev.jquery.com/view/tags/ui/latest/ui/ui.draggable.js"></script>
<div>
<input type="button" size="10" name="fl_do" onclick="doAjax()" value="get" />
<pre id="content"></pre>
</div>
<div id="example" class="flora" title="This is my title">I'm in a dialog!</div>
</body>
</html>
Perl:
#!/usr/bin/perl use strict; use warnings; use CGI qw(:standard); my $tm = localtime(); print header(); print qq(<html> <head> <title>test</title> </head> <body> <h1>Test data.</h1> $tm </body> </html>);
This is just how browsers work; it's a byproduct of being single threaded. You'll need to use a setTimeout to let the browser do a refresh after you open the dialog.