how to increase the time gap of wait message

iam trying to show wait message while data is being fetched from database. iam using ajax to fetch the data. the message is already showing but it will disappear quickly. how can i increase the time gap for wait message ,that is the user can view the messge for atleast 4 seconds

   <input onchange="mail()" class="span6 m-wrap"  type="text" value="" name="mail_id" type="text" id="mail_id" placeholder="Type your mail" />
  <div id="loader" style="display:none;">please wait</div>
function mail()
{

    var Email=$('#mail_id').val();   
    $.ajax({
        url: "<?echo base_url()?>mailsetr/mail_fetch",
        dataType: "json",
        type: "POST",
        data: {Email:Email}, 
        success: function (res) {
            var status =  res.user_status;
            var name =  res.user_name;
            var id =  res.user_id;  
            if(status == 1)
                {

                document.getElementById("name").value =name ;
                document.getElementById("id").value =id ; 
            } 
            else
                {
                document.getElementById("name").value ='';
                document.getElementById("id").value =''; 
            }
            $('#loader').hide();
        }, 
        beforeSend: function () 
        {
            $('#loader').show();

        }
    });
} 


Source: ajax

Leave a Reply