Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Nov 2010
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Overlays, blocking UI and un-blocking UI

    This code works when the page is loaded, but doesn't work on the AJAX Post call back.
    Code:
    $(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.

  • #2
    New to the CF scene
    Join Date
    Nov 2010
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Solved it myself.
    Needed to place code in different places.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •