![]() |
Ajax preloader image
Hi guys,
I am still new at Javascript, and have some difficulty getting a preloader image to display in my existing code. Basically the user submits an identity number which is sent to another php file for verification, and the result is displayed without refreshing the page. For this I came accross this Ajax code: function submitForm() {Here is the form code: <form id="ValidationForm" onsubmit="return submitForm();"> <input type="text" name="number"> <input type="Submit" value="Verify"> </form> How can I amend the above code to have a preloader image (or text) shown while the user waits for the result? I have read about the readystate event, but my attempts to use it in the JavaScript above failed. Help will be greatly appreciated. Thanks |
this assumes your loading image or container element has a class of loaderimg
- also this only happens upon a successful ajax request, you should also consider using the error: setting as well - if you havent already ofc ourse Code:
function submitForm() { |
Thanks DanInMa,
Solution was relative simple, but since I didn't know better, you directed me in the right direction. I added a div with the loader image in the container element, and made it not visible: Quote:
Quote:
And it works perfect! |
| All times are GMT +1. The time now is 02:35 AM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.