Return document attachment from AJAX callback

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Return document attachment from AJAX callback

Esteban A. Maringolo
Is it possible to return a document attachment as a response of an ajax

I'm currently returning a file as part of a regular action callback
associated with an anchor, but as most of the app is AJAX driven, it
would be convenient to not only return such document, but to do return
the document and/or a script to keep the UI in sync.

I'm currently returning the document by doing the following as part of
the callback:

self requestContext respond: [:response |
     attachmentWithFileName: ...;
     contentType: ...,
     nextPutAll: byteArray;

And I'd like to do something like.

html anchor
  onClick: (html jQuery ajax
              callback: [self downloadFile];
              script: [:s | ... ]);
  with: 'Download file'.


Esteban A. Maringolo
seaside mailing list
[hidden email]