title: href is responding thought it is false
body: <p>guys I have a situation here. Im trying to validate an input from user that if the input is <code>!= ""</code> it will do what inside the if and if its else it will do what inside the else. the validation is quite working except for one thing. though the condition is false it is still going inside the if condition and refreshing the the whole system by using this code <code>$(location).attr('href','account_setting_registrar.php');</code></p>
  
  <p>can you help me?</p>
  
  <pre><code>        $(document).ready(function (){
           var username ;
           var eadd;
  
  $('#change_usrname_button').click(function (){
      username = $('#new_chnge_username').val();      
  
              if(username != "" ){
                      $.ajax({
                          type: 'POST',
                          url: 'account_setting_registrar_get.php',
                          dataType: 'json',
                          data:'username='+username,
                          success: function (data){
  
  
                                     if(data.error == false){
  
                                      alert("your username is successfuly changed");
  
                                         $(location).attr('href','account_setting_registrar.php');
                                     }
                                     else{
                                      alert("update error");
                                   }
                         }  
                      });
  
                  }
  
                  else{
                     alert("please put the new username");
                   }
  
  
  });
  
  
  
              $('#change_eadd_button').click(function (){
  
  
                  eadd = $('#new_chnge_eadd').val();
  
  
                  if(eadd != "" ){
                          $.ajax({
                              type: 'POST',
                              url: 'account_setting_registrar_get.php',
                              dataType: 'json',
                              data:'emailadd='+eadd,
                              success: function (data){
  
                                 if(data.error == false){
  
                                  alert("your email address is successfuly changed");
                                  $(location).attr('href','account_setting_registrar.php');
                                 }
  
                                 else{
                                  alert("update error");
                                 }
  
                               }
                          });
                   }
  
                   else{
                     alert("please put the new username");
                   }
  
  
  
          });
  
              });
  </code></pre>