Fade In ok, Fade out not ok. What the reason?
I actually have a JSP page with this basic HTML elements;
- <div style="display:none;" id="loadingBar"><img src="images/loading-big.gif" alt="loading"/> </div>
- <div style="display:none;" id="result"></div>
and then the JQUERY with these source code;
- var content;
- var dataString = "ha";
- $( function() {
- $.validator.addMethod("username", function(value, element) {
- return this.optional(element) || /^[a-z0-9\_]+$/i.test(value);
- }, "UserID: only letters, numbers, or underscore.");
- $('#userAccountForm').validate();
- $('input').focus( function() {
- content = $(this).val();
- if(content=='- none -') {
- $(this).val("");
- }
- } );
-
- $('input').blur( function() {
- content = $(this).val();
- if(content=='') {
- $(this).val("- none -");
- }
- } );
- $('.tableModifierButton input:submit').click( function(){
- var emptyThing = "- none -";
- // ensure all fields are not empty
- // we use word - none - as empty field
- var usName = $('#username').val();
- var email = $('#email').val();
- var contc = $('#mobilephone').val();
- // var photo = $('#avatar').val();
- var usId = $('#userid').val();
- var pass = $('#password').val();
- var editClient = $('input:radio[name=editClient]:checked').val();
- var addClient = $('input:radio[name=addClient]:checked').val();
- var delClient = $('input:radio[name=deleteClient]:checked').val();
- var adminPriv = $('input:radio[name=adminPriv]:checked').val();
- if(adminPriv==undefined){
- adminPriv = "staff";
- } else {
- adminPriv = "administrator";
- }
- if(usName==emptyThing){
- usName = "none";
- }
- if(contc==emptyThing){
- contc = "0";
- }
- if(pass==emptyThing){
- pass = "default";
- }
- dataString = 'username='+usName+"&contact="+contc+"&email="+email+"&userid="+usId+"&password="+pass+"&editclient="+editClient+"&addclient="+addClient+"&deleteclient="+delClient+"&adminprivillege="+adminPriv;
-
- $('#userAccountForm').fadeOut(1000, function(){
- $('#loadingBar').fadeIn(300);
- } );
- var options = {
- type: "POST",
- url: "user-form-function",
- data: dataString,
- success: function(msg){
- $('#result').html(msg).fadeIn("slow");
- $('#loadingBar').fadeOut("slow");
- }
- };
- $.ajax( options );
- return false;
-
- } );
- } );
Strangely is... the
loadingBar FadeIn effect come nicely.
But when at line 73; when It reached success call, it never fading out.
- $('#loadingBar').fadeOut("slow");
is this line not working when it came into success portion or.... there's something wrong with my source code? I confused ....