I want to show "wait" message with plugin http://www.malsup.com/jquery/block/. ajax.php file is
<?php
sleep(2);
$arr = array('m' => 'OK');
echo json_encode($arr);
?>
And jquery code is
function block() {
$.blockUI();
$.ajax({
type: 'POST',
dataType: 'json',
url: 'ajax.php',
async: false,
data: {},
success: function(data) {
$.unblockUI();
}
});
}
block();
$('#button').click(function() {block();});
How to show a "loading.."-message BEFORE of using ajax for getting "OK" and hide AFTER of using ajax? Now it shows and hides after using. I need also "async: false," in ajax json. Also that this block show two seconds.
Thanks