Abdul Basith

Abdul Basith

  • NA
  • 22
  • 8k

.Show() is not working

Mar 18 2016 1:14 AM
Hi,
There is a Mail sending scenario in my project.It takes little bit time to process.so i thought to add a 'Loading Image'.After clicking the send button the 'Loading image should be displayed until the process stops.
my HTML code is given here:
 
  1.     <div id="abc" >  
  2.         <!-- Popup Div Starts Here -->  
  3.         <div id="loadingmessage"style= "display:none; z-index: 9999;  
  4.     width: 100px;  
  5.     margin-left: auto;  
  6.     margin-right: auto;  
  7.     margin-top: 28%;">  
  8.        <img src="~/Images/Bank/ajax-loader.gif"/>  
  9.     </div>  
  10. <div id="popupContact">  
  11.       
  12. <!-- Contact Us Form -->  
  13.     <div id="form">  
  14.         <img id="close" src="~/Images/Bank/3.png" />  
  15.           
  16.         <h2>Confirm your email</h2>  
  17.         <hr>  
  18.         <div class="dummy">  
  19.         <label> To :</label>  
  20.         <input id="name" name="email" type="text">  
  21.         </div>  
  22.         <div class="dummy1">  
  23.         <label>  Subject:</label>  
  24.         <input id="email" name="email" type="text">  
  25.         </div>  
  26.         <div class="dummy2">  
  27.         <label>  Message:</label>  
  28.         <textarea   id="msg" name="message" ></textarea>  
  29.         </div>  
  30.                 <input type="button" id="submit" value="Send" />  
  31.         </div>  
  32.   
  33. </div>  
  34. <!-- Popup Div Ends Here -->  
  35. </div>   
My Java script /jQuery code is :
 
  1. $("#submit").click(function () {  
  2.       $("#loadingmessage").show;  
  3.       if ($("#name").val() == '') {  
  4.           $('#name').focus();  
  5.       }  
  6.       else if ($("#email").val() == '') {  
  7.           $('#email').focus();  
  8.       }  
  9.       else if ($("#msg").val() == '') {  
  10.           $('#msg').focus();  
  11.       }  
  12.       else {  
  13.           var model = {  
  14.               To: $("#name").val(),  
  15.               Subject: $("#email").val(),  
  16.               Message: $("#msg").val(),  
  17.           }  
but here the Loading image is not showing after the click event.
Help me if anyone can solve this.. 

Answers (10)