Search code examples
jqueryblockui

BlockUI not unblocking


I've been staring at this for HOURS and I can't see why on earth this isn't working, I have confess my JS isn't top notch but to me this looks right?

Basically when I click the blockui comes up fine but it never goes away! Cut down version of the code below...

$(document).ready(function() {
    $("#formdata").toggle();
    $(function() {
        $( "#datepick" ).datepicker();$("#datepick").datepicker({
            dateFormat: "yyyy-mm-dd" });
    });
    $(document).ajaxStart(function() {
        $.blockUI({message: '<h1>Retrieving data</h1>'})
    });
    $(document).ajaxStop(function() {
        $.unblockUI();
    });
});

    $(".button").click(function() {  
    var dataString = $("myform").serialize();

    $.ajax({  
        type: "POST",  
        url: "employerformdata.php",  
        data: dataString,  
        success: function(data) {
            $("submitresult").html(data);
        }
    });
});

Solution

  • ajaxComplete function to unblock UI

    reference http://docs.jquery.com/Ajax_Events