On Wed, Feb 06, 2008 at 08:21:25PM -0800, apadley wrote:
> 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(); });

See http://malsup.com/jquery/form/#options-object
You can use beforeSubmit pointing to something like

    function () {
        $('#container').html('Loading...')
        }

Works here (tm).

Cheers
 Christoph
-- 
[EMAIL PROTECTED]  www.workaround.org   JID: [EMAIL PROTECTED]
gpg key: 79CC6586         fingerprint: 9B26F48E6F2B0A3F7E33E6B7095E77C579CC6586

Reply via email to