I have a django application that creates xls and txt files.
I’m trying to create a button which sends a jQuery.get request to django, django then returns a freshly created file to jQuery which in turn pops open a save as dialog.
My code looks like this:
jQuery("#testButton").live("click",function()
{
jQuery.jGrowl("click");
jQuery.get("/filetest",function(data){});
});
<div id="testButton" class="button">CLICK TO TEST</div>
Getting the file to jQuery is easy, but I have no idea how to then raise a Save As dialog.
Any assistance would be fantastic!
you can use iframe in your page and change with jquery the source, to the file you want to download.
this code put in html body :
and the jquery in event of click look like:
in your sever side send the file back when the request
make_excellwith a content-type