Guys I am working on a flight booking api integration project. Every thing is working fine when I click for search flights on button progress bar comes in a fine way.But Problem I am getting is that I am calling progress bar from javascript and when there are validation error on the page still progress bar shows up. So my question is how to hide progressbar when there are validation errors on page I am using asp.net server validations.
My javascript is like this:
<script type="text/javascript" src="http://ift.tt/1fEahZI"></script>
<script type="text/javascript">
function ShowProgress() {
setTimeout(function () {
var modal = $('<div />');
modal.addClass("modal");
$('body').append(modal);
var loading = $(".loading");
loading.show();
var top = Math.max($(window).height() / 2 - loading[0].offsetHeight / 2, 0);
var left = Math.max($(window).width() / 2 - loading[0].offsetWidth / 2, 0);
loading.css({ top: top, left: left });
}, 200);
}
function changes() {
ShowProgress();
}
</script>
I am calling it on button click like thsi:
<asp:Button ID="btnSearch" OnClientClick ="changes();" runat="server" ValidationGroup ="r" Text="Search" Height="40px"
Width="134px" onclick="btnSearch_Click" />
My progress bar div is like this:
<div class="loading" align="center">
Loading. Please wait.<br />
<img src="load.gif" style="height:50px; width :50px;" alt="" />
</div>
Aucun commentaire:
Enregistrer un commentaire