Trigger an mvc ajax refresh automatically every X minutes

I have a Refresh button on my page that will perform an mvc ajax post to update some of the content on the page. The refresh/update process can be long running (about 10-20 seconds). Right now the user has to manually click the Refresh button to trigger the refresh. I want to trigger the refresh automatically every X minutes. Pretty much I want to trigger this same Ajax post as below (and it would be nice to display the LoadingElementId too).

<% using (Ajax.BeginForm("Refresh", null, 
                   new {userId=Model.UserId},
                   new AjaxOptions { UpdateTargetId = "UserForm", LoadingElementId = "RefreshingDiv" },

                    <button type="submit">
                        <img src="/zsys/img/icons/refresh.png" alt="Refresh" />

            <% } %>

How can I force the mvc ajax postback?

13.10.2009 15:13:34

jQuery timer + call $('#form').submit() should do the trick.

13.10.2009 15:47:07
$('#RefreshForm').submit(); is doing a full postback and not ajax postback. Any ideas?
Jeff Widmer 13.10.2009 17:36:44
Instead of submitting the form, I used jquery to click the refresh button: $('#RefreshFormButton').click();
Jeff Widmer 13.10.2009 17:38:50
Good point--I tend to use jquery ajax form, and that overrides the submit method so I call stuff that way. But if you aren't doing that then calling your submit method makes lots of sense.
Wyatt Barnett 13.10.2009 18:07:27

Wyatt Barnett's answer made me try just clicking the Refresh button for the user. And then I used setInterval to trigger the Refresh Button click every 5 minutes:

    <script src="../../scripts/jquery-1.3.2.min.js" type="text/javascript"></script>

    <script type="text/javascript">
        $(document).ready(function() {
            setInterval("$('#RefreshFormButton').click()", 300000);
13.10.2009 17:53:04

Put the RefreshFormButton in the id submit button .... well you get the JS function to work.

17.06.2010 20:43:18