I have a situation where I create a form dynamically and submit to my server-side controller so I can query my database and return a csv file. I need to be able to put up an overlay so the user can't hammer the submit button and send 10 requests to get the file back.
Because of this I CANNOT use ajax since ajax will not allow me to send back a file for the browser to automatically detect and ask the user to download.
showSpinner();
    var $form = $("<form/>")
        .addClass("hidden")
        .attr("accept", "application/json")
        .attr("action", "/myPath")
        .attr("method", "POST")
        .appendTo("body");
    $form.bind('ajax:complete', function() {
        hideSpinner();
    });
    $form.submit();
"ajax:complete" was just something I was trying with no luck. I also tried putting the hideSpinner right after the .submit(). But that just hides the spinner immediately since .submit() seems to be async.
