The code below exhibits the following problem:
If a menu selection disables the menu, performs an Ajax get, and in
the 'always' part of the get enables the menu, it takes one
extra click on the menu before the menu selects again.
(Load the code, click on '1' or '2', get disable
and enable alerts, and click on '1' again. You need to click
once more to see the same sequence. Tested in Safari.)
<!DOCTYPE html>
<html>
<head>
<link rel='stylesheet' type='text/css'
<script type='text/javascript'
<script type='text/javascript'
<script>
$(function () {
$('#menu').menu({
select: function (event, ui) {
$('#menu').menu('disable');
alert(ui.item.text()+' menu disabled')
$.get('test.html')
.done(function () {
alert('done')
})
.fail(function() {
alert('fail')
})
.always(function (){
$('#menu').menu('enable');
alert(ui.item.text()+' menu enabled')
});
}
});
});
</script>
<title> n/a </title>
</head>
<body style='overflow: hidden'>
<ul id='menu'>
<li> 1 </li>
<li> 2 </li>
</ul>
</body>
</html>