I am using jquery block UI plugin, my requirement is to check if user is authorized user or not, here is my code
<script language="javascript" type="text/javascript">
$(document).ready(function () {
$('#btnsubmit').click(function () {
$.blockUI({ css: {
border: 'none',
padding: '15px',
backgroundColor: '#000',
'-webkit-border-radius': '10px',
'-moz-border-radius': '10px',
opacity: .5,
color: '#fff'
}
});
});
});
function ajaxAuth() {
//UserLogin.IServiceLogin.HelloWorldCC(OnSuccess, OnFailure);
var usrname = document.getElementById('txtusrname').value;
var pasd = document.getElementById('txtpassword').value;
UserLogin.IServiceLogin.GetUseCred(usrname, pasd, onSuccess, onFailed);
}
function onSuccess(result) {
setTimeout($.unblockUI, 0);
var obj = jQuery.parseJSON(result);
if (obj.name != "error" ) {
document.getElementById('labusr').value = obj.name;
document.getElementById('labpass').value = obj.passd;
document.getElementById('labkey').value = obj.key;
location.href = "DesignAPage.aspx";
} else {
$.blockUI({ message: $('#question'), css: { width: '350px'} });
// $('#ok').click(function () {
// $.unblockUI();
// return false;
// });
}
}
function onFailed(result) {
alert("failure");
}
</script>
so the problem is while i am using $.blockUI({ message: $('#question'), css: { width: '350px'} });
it just blocks the screen for a second and unblocks the screen.
Any help is greatly appreciated
try doing this in else block
else {
$.unblockUI({
onUnblock: function () {
$.blockUI({ message: $('#question'), css: {
border: 'none',
padding: '15px',
backgroundColor: '#000',
'-webkit-border-radius': '10px',
'-moz-border-radius': '10px',
opacity: .5,
color: '#fff'
}
});
$('#ok').click(function () {
$.unblockUI();
return false;
});
}
});
}