I want to instantiate a loading image after submitting a form with jQuery.
I found how to do this and its working fine, but it is always for ALL jQuery requests done on the page.
Here is an example: How can I create a "Please Wait, Loading..." animation using jQuery? or here How to show loading spinner in jQuery?
Is there a way I can achieve the same effect, but only when I submit a form?
Or is there a way I can attach this to specific functions, so it only runs the "loading" image on these functions?
I have this function on a page (with other jQuery functions as well), and would like to attach the "loading" image only on this function:
<script>
function send_temp(form) {
jQuery.post('editor.php?bar=<?php echo $id?>', jQuery(form).serialize(),function(data) {
jQuery('#editor').html(data);
});
}
</script>
The function is called when I submit a form.
Thanks for any help or suggestions.