0

I am trying to trigger the download pop up box on firefox using an Ajax jquery call. my jquery code is this:

function download_clip(){
    $.ajax({
        url: '/controller/download_clip',
        type: "GET",
        complete: function (data_response) {
            status = data_response.responseText; //the response variable from the presentation controller
            console.log(status);
        }
    });
};

in my controller:

  def download_clip
       send_file "public/output.mp4", :type=>"video/mp4", :filename => "output.mp4", :x_sendfile=>true, :disposition => 'inline'
  end

Any ideas how to trigger the download box?

4

1 回答 1

0

...好吧,我认为如果你这样做,Firefox 自己会这样做

document.location.href = "/controller/download_clip";

用javascript。

于 2012-12-11T09:20:22.090 回答