...

View Full Version : jQuery Overlays, blocking UI and un-blocking UI



j9sjam3
11-12-2010, 11:53 PM
This code works when the page is loaded, but doesn't work on the AJAX Post call back.


$(document).ready(function() {
var H = $(window).height();
$('#footer').css('top', H -30);

$('#overlay').css('height', H).fadeTo('fast', 0.5);

jQuery.each(jQuery.browser, function(i, val) {
if(i!="mozilla" && jQuery.browser.version.substr(0,3)!="1.9") {
alert("WARNING: You are not using Firefox 3+. \nWe reccomend using Firefox 3+ for security, speed and compatibilty.");
return false;
}
});

$('#login2').click(function() {
$('#login2').attr('disabled', 'disabled');
var user = $('#username').val();
var pass = $('#password').val();
blockUI();
$.ajax({
type: "POST",
url: "processor.php",
data: "id=login&user="+user+"&pass="+pass,
success: function(msg){
unblockUI();
$('#login2').attr('disabled', '');
}
});
});
});
function blockUI() {
$('#overlay2').css('display', 'inline');
$('#overlay').css('display', 'inline');
$('#overlay').css('height', H).fadeTo('fast', 0.5);
}
function unblockUI() {
$('#overlay').css('display', 'none');
$('#overlay2').css('display', 'none');
}
$(window).load(function() {
var t=setTimeout("unblockUI()", 1000);
});


The callback is working, I tested it with an alert.
Like I said, the block UI and unblock UI work, hence the timer.

I have no idea what else there is to do now. Any help would be brilliant.

Cheers.

j9sjam3
11-13-2010, 12:06 AM
Solved it myself.
Needed to place code in different places.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum