Element 'Mysteriously' reappearing
Hopefully this is not a duplication...
I have created a login screen that uses
jQuery.post for validation. During validation it shows and then hides a #loading div to denote that the data is being validated. The problem I am having is that,on some occasions (more often than I like), the #loading div appears to blink and does not go away. You can test it yourself at
test link,
The css code for this div is:
- #loading {
- clear:both;
- position:absolute;
- display: none;
- background: url('/images/wait.gif') center 15px no-repeat white ;
- text-align:center;
- padding: 25px;
- font-size:12px;
- font-family:Verdana, Arial, Helvetica, sans-serif;
- border: #000099 1px solid;
- }
The HTML is (the #loading div is at the bottom):
- <div id="dialog" class="window">
-
- <form id="frmLogin" action="" >
- <input type="text" id="userName" name="userName" />
- <input type="password" id="password" name="password" />
- <input type="image" src="images/loginBtn.png" id="mySubmit"
- onClick="login_verify(event,this);"/>
- </form>
- <div id="msgError"></div>
- <a href="javascript:void(0)" class="close" onClick="login_close(event,this)">Close it</a>
- <div id="loading"><br /><br />LOADING</div>
- </div>
The code to control this is:
- $("#loading").show("fast");
- $.post("login.php", $("#frmLogin").serialize() ,
- function(data) {
- $("#mySubmit").removeAttr("disabled");
- if (data.length > 0) {
- $("#msgError").html(data);
- $("#msgError").show();
- $("#loading").hide();
- } else {
- $("#loading").hide();
- window.location = "http://www.google.com";
- }
- }
- );
I have scoured the code and this is the only place where
$("#loading").show("fast"); and
$("#loading").hide(); are located.
I am thinking it is an issue with the .post callback function so I have put an alert() function in the callback function and it is being called every time.
Thanks