Reloading a div

Reloading a div

Hi,

I am using a Ajax to call a PHP script in order to authenticate users on my website. Depending on the response returned I am displaying one of two divs (success or failure). If the login is successful I want to display the name of the authenticated user within the welcome message on the relevant div.

My thoughts were to set a PHP SESSION variable in my login.php script and then reload the success div before I display it.

Here is my code:

  1.           $.ajax({
  2.                type: "POST",
  3.                dataType: "json",
  4.                data: "username="+user+"&password="+pass,
  5.                url: "login.php",
  6.                success:function(result){   
  7.                     $('#mask').show().fadeTo('', 0.7);
  8.    
  9.                     if(result['response']==1){
  10.                          $('div#alert.success').reload();
  11.                          $('div#alert.success').fadeIn();
  12.                     }
  13.                    
  14.                     if(result['response']==0){                            
  15.                          $('div#alert.fail').fadeIn();             
  16.                     }
  17.                                    
  18.                     $('div#alert, div#mask').click(function(){
  19.                          $('div#alert, div#alert, div#mask').stop().fadeOut('fast');
  20.                          location.reload();
  21.                     });
  22.                }
  23.               
  24.           });
  25.          
  26.      return false;
  27.      
  28.      });
As you can see on line 10 I am trying to reload the div then fade it in but it doesn't work.

What am I doing wrong? Is my general approach correct?

Thanks in advance,

Johnny.