[jQuery] ajaxSubmit and Loading message
I have a complex form that uses ajaxSubmit (see code below). The form
takes awhile to process and I'd like to display a loading message or
loading gif while waiting for the response. How can I modify or add to
the code below to accomplish this. The message or gif should appear in
the #container div.
var v = jQuery("#two").validate({
submitHandler: function(form) {
jQuery(form).ajaxSubmit({
target: "#ajax",
resetForm: "true"
});
},
debug: "false",
errorContainer: container,
errorLabelContainer: $("ol", container),
wrapper: 'li',
event: "keyup"
});
I have tried adding the following which shows the loading gif, but
does not display the result from the action page in the ajax div :
$("#container").ajaxStart(function(){ $(this).show(); }).ajaxStop
(function(){ $(this).hide(); });
If I just use the following I get the loading gif in the container div
and the result in the ajax div, but the loading gif does not disappear
when the ajax div finishes loading:
$("#container").ajaxStart(function(){ $(this).show(); });
Thanks.