0

In my login page I need a function where user clicks on the "Login" button and a loader appears (GIF or any kind of message) before page fully loads.

I tried many ways to do that but I wasn't successful. The loader only shows up after page is fully loaded.

Is there any function that it can display the loader while page is loading or server is processing?

enter image description here

I appreciate your efforts in reaching a solution for my problem.

8
  • you're looking for asp:UpdateProgress Commented Aug 14, 2015 at 14:12
  • Thanks @fubo for your quick response but unfortunately I can't use UpdatePanel on that page since there are some CSS styles where they get disappeared if page doesn't fully PostBack and this also applies to ASP:ScriptManager, as soon as I put ScriptManager in my page the RequiredFieldValidator doesn't validate my fields until it does PostBack. Commented Aug 14, 2015 at 14:16
  • Try to perform login using ajax as it is async. Commented Aug 14, 2015 at 14:18
  • @Akshay Thanks for your response, can you show an example? Commented Aug 14, 2015 at 14:19
  • Perform ajax call as $.ajax({ url : 'your_url', type: 'POST', dataType: 'json', data: 'your_data', dataType: 'application/json; charset=utf-8' success: function() { } }); Before calling ajax you can show the spinner and hide it in success function. Commented Aug 14, 2015 at 14:22

1 Answer 1

1

Here is what you can do

$('#btn_id').click(function () {     
    var username = $('#username').val(); 
    var password = $('#password').val(); 

    if (username != "" && password != "") { 
    $('#Loader').modal(); 
    } 
});
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.