JavaScript Implementing a loading spinning wheel in javascript

In my web site I need to pop up a dummy 'loading' spinning wheel when click a button and vanish after some time. It's just a dummy page. I would be much obliged if anyone can explain how to do such a thing. Can I do this with javascript or jQuery?

Thanx in advance

Answer:1

Have a div/image in the right place you need, hide it first time the page loaded. like

<input type="button" id="button"/>
  <div id="load"><img src="http://jimpunk.net/Loading/wp-content/uploads/loading1.gif"/>
</div>

and in your jquery, set a handler for the click event of button to show or hide the div

$(document).ready(function(){
  $('#button').click(function(){
    $('#load').show();
    setTimeout(function() {$('#load').hide()}, 2000);
  });
});

setTimout can be used to hide the div after some time. check the workign example here

Answer:2

you can do it by ajax or simply jquery.

here is the ajax way

$.ajax({
       type: "POST",
       data: serializedDataofthisform,
       dataType: "html",     /*  or json   */
       url: "your url",
       /*  ajax magic here   */
       beforeSend: function() {
      $('#loaderImg').show();    /*showing  a div with spinning image */
        },
       /* after success  */
       success: function(response) {

       /*  simply hide the image */    
       $('#loaderImg').hide();
       /*  your code here   */
      }
     });

html

<div id="loaderImg"><img src="path" alt=""/></div>

Javascript by time out function :- setTimeout()

Answer:3

$(document).ready(function(){ var links = $('body').find('a.internal'); links.on('click', function(e){ //pull page with ajax and replace the content with this response //...

$(document).ready(function(){ var links = $('body').find('a.internal'); links.on('click', function(e){ //pull page with ajax and replace the content with this response //...

  1. jquery reset variable
  2. jquery setting width
  3. jquery setting value
  4. reset recaptcha jquery
  5. resetting in jquery
  6. resetting form in jquery
  7. resetting dropdown in jquery
  8. reset form using jquery
  9. resetting textbox in jquery

Ok, so I have multiple inputs that receive UUID codes. So Im using the .each function from jQuery to go one by one and validate the input to be a UUID code. So this is the code that I have until now: ...

Ok, so I have multiple inputs that receive UUID codes. So Im using the .each function from jQuery to go one by one and validate the input to be a UUID code. So this is the code that I have until now: ...

  1. jquery regex test online
  2. jquery regex test is not a function
  3. jquery regex test
  4. jquery regex test pattern
  5. jquery regex test example
  6. jquery regex test string
  7. jquery regex test method
  8. jquery regex test ignorecase
  9. jquery regex valid email
  10. jquery regex match test
  11. jquery regex email test
  12. regex.test jquery not working
  13. jquery regex match vs test

I've wrote a simple 'add page' form to a small CMS I've built and I have a simple preview feature which submits a form and opens the front-end version of the page in a new window. To achieve this up ...

I've wrote a simple 'add page' form to a small CMS I've built and I have a simple preview feature which submits a form and opens the front-end version of the page in a new window. To achieve this up ...

  1. submit form window.open
  2. submit form window.open javascript
  3. form submit window close
  4. form submit window.location
  5. form submit window.location.href
  6. form submit window
  7. form submit window tab
  8. submit form new window
  9. submit form on window load
  10. submit form new window javascript
  11. submit button windows form
  12. submit form popup window
  13. submit form using window.open
  14. submit form modal windows
  15. submit form open new window
  16. submit form to parent window from iframe
  17. javascript form submit window.location
  18. submit form in parent window from popup
  19. submit form in new window jquery
  20. submit form to popup window jquery

I follow the practice of always using a absolute comparison '===', but some learned colleagues have argued that this is an unnecessary waste of computation time on type-checking in situations where ...

I follow the practice of always using a absolute comparison '===', but some learned colleagues have argued that this is an unnecessary waste of computation time on type-checking in situations where ...