[Seaside] File download confirmation
johan at inceptive.be
Sun Apr 27 12:22:48 UTC 2014
I don't think you can do a file download using an ajax request.
You will need to do it like this:
You can probably insert the use of a confirmation dialog in the script above (untested):
There also exist jQuery plugins  to get close to an ajax-like behavior for file downloads.
On 25 Apr 2014, at 16:21, bobn at rogers.com wrote:
> I would like to add a confirmation to a file download. The problem I'm seeing is that my page does not refresh after the file download, so that any confirmation dialog is not cleared. Ideally I'd use an ajax callback to trigger the file download; the callback code does get triggered, but the file is not downloaded. I figure I'm missing something obvious.
> File download is using...
> self requestContext respond: [:response | response contentType: ... ]
> ...so I understand why the rendered dialog does not refresh, given that the response is not the page content.
> Using an ajax callback...
> onClick: ( (html jQuery ajax callback: [self downloadMethod]) ... )
> ...does not do the download, even though the download method is triggered.
> That also makes sense, since the requestContext is the ajax callback, not the page get.
> So, what this trick? ... I hate not seeing what should be a simple solution :-)
> Thanks for any help,
> Bob Nemec
> seaside mailing list
> seaside at lists.squeakfoundation.org
More information about the seaside