AjaxSubmit File Upload - Trying to get response $(document).ready() to fire

Posted by ncyankee on Stack Overflow See other posts from Stack Overflow or by ncyankee
Published on 2010-05-21T03:45:31Z Indexed on 2010/05/21 3:50 UTC
Read the original article Hit count: 622

Filed under:
|
|

I'm using the jquery form plugin (http://malsup.com/jquery/form/) to upload a file via ajax which is processed in the background.

The upload is working correctly, and I am using ASP.Net MVC to return a partial view which contains a $(document).ready call to setup a 'timer' to check on the status of the upload file's processing status. When I return the partial view which contains a script block wit ha $(document).ready call, it is never fired, therefore the 'timer' to check for the status of the upload is never started.

When I do this via a regular $.post call (without upload) the function fires correctly after the html is loaded into the DOM. Is there anything else I need to do when calling the ajaxSubmit function to get this to fire?

Just a sample bit of code:

$('form').live('submit', function () {
                $(this).ajaxSubmit({                   
                    success: function (data) {                        
                        $('#statusDiv').html(data);                        
                    }
                });               
                return false;
            });

© Stack Overflow or respective owner

Related posts about AJAX

Related posts about jQuery