Can jQuery retrieve a file?

Posted by danspants on Stack Overflow See other posts from Stack Overflow or by danspants
Published on 2010-06-03T04:48:24Z Indexed on 2010/06/03 4:54 UTC
Read the original article Hit count: 319

Filed under:
|
|
|

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!

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about html