Return document attachment from AJAX callback

"Esteban A. Maringolo" <[email protected]>
Newsgroups gmane.comp.lang.smalltalk.squeak.seaside
Message-ID <[email protected]>
Is it possible to return a document attachment as a response of an ajax
call?

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:

downloadFile
self requestContext respond: [:response |
   response
     doNotCache;
     attachmentWithFileName: ...;
     contentType: ...,
     binary;
     nextPutAll: byteArray;
     respond
]

And I'd like to do something like.

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

Regards,

-- 
Esteban A. Maringolo
_______________________________________________
seaside mailing list
[email protected]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.