Friday 15 March 2013

javascript - JS pageshow event triggerring on form validation -



javascript - JS pageshow event triggerring on form validation -

so have below js show loading gif while servlet adds info , redirects. when submit form fires on click event no problem. right after runs pageshow , hides div again. makes no sense me, i'm still on same page. point of pageshow if clicked back, page doesn't stuck on loading gif. why pageshow beingness triggered after validation check? missing

class="snippet-code-js lang-js prettyprint-override">// ==== [start] search gif hide , show ==== $("#equipsrch").click(function () { if ($("#search-form").valid()) { document.getelementbyid("viewsrch").style.display = 'none'; document.getelementbyid("loading").style.display = 'block'; } }); $(window).bind('pageshow', function () { document.getelementbyid("viewsrch").style.display = 'block'; document.getelementbyid("loading").style.display = 'none'; }); // ==== [end] search gif hide , show ==== class="snippet-code-html lang-html prettyprint-override"><script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>

i missing jquery imports, valid() function firing getting exception missed before. failed phone call validate() function first.

class="snippet-code-js lang-js prettyprint-override"> // ==== [start] search gif hide , show ==== $("#submit").click(function() { $("#search-form").validate(); if($("#search-form").valid()) { document.getelementbyid("viewsrch").style.display = 'none'; document.getelementbyid("loading").style.display = 'block'; } }); $(window).bind('pageshow', function() { document.getelementbyid("viewsrch").style.display = 'block'; document.getelementbyid("loading").style.display = 'none'; }); // ==== [end] search gif hide , show ==== class="snippet-code-html lang-html prettyprint-override"><script src="http://code.jquery.com/jquery-1.11.1.min.js"></script> <script src="http://jqueryvalidation.org/files/dist/jquery.validate.min.js"></script> <script src="http://jqueryvalidation.org/files/dist/additional-methods.min.js"></script>

javascript jquery html5

No comments:

Post a Comment