2012-12-10 1 views
0

Ajax jquery 호출을 사용하여 firefox에서 다운로드 팝업 상자를 트리거하려고합니다. 내 jQuery 코드는 이것이다 : 내 컨트롤러에서레일즈 3을 사용하여 다운로드 팝업 상자를 트리거하는 방법

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); 
     } 
    }); 
}; 

:

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

모든 아이디어를 어떻게 다운로드 상자를 유발하는?

답변

0

은 ... 글쎄, 난 당신이 자바 스크립트로

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

을 할 경우 파이어 폭스가 그 자체로이 작업을 수행 생각합니다.

관련 문제