Loading ...
Sorry, an error occurred while loading the content.

Re: Ajax callback should open returned content

Expand Messages
  • Thomas S. Sha
    ... return a text file or excel file as the return of my AJAX call? That is how can I get the browser to come up with a Save As or Open With dialog? Connection
    Message 1 of 6 , Oct 31, 2006
    • 0 Attachment
      --- In ydn-javascript@yahoogroups.com, "Loubser Francois"
      <floubser@...> wrote:
      >
      > Hi
      >
      > What do I have to do in the callback handleSuccess if I want to
      return a text file or excel file as the return of my AJAX call? That
      is how can I get the browser to come up with a Save As or Open With
      dialog?

      Connection manager -- or XHR for that matter -- is not the right
      mechanism to accomplish the described task - to throw a "Save As" dialog.

      Attempting to request binaries via connection manager/XHR will result
      in a binary stream which is problematic at best.

      Regards,
      Thomas
    • Josh Peters
      ... What I would do is to have your success handler create a download link, ala what Google video does after you choose the type. Instead of returning the
      Message 2 of 6 , Oct 31, 2006
      • 0 Attachment
        On 10/31/06, Thomas S. Sha <tsha@...> wrote:
        > --- In ydn-javascript@yahoogroups.com, "Loubser Francois"
        > <floubser@...> wrote:
        > > Hi
        > >
        > > What do I have to do in the callback handleSuccess if I want to
        > return a text file or excel file as the return of my AJAX call? That
        > is how can I get the browser to come up with a Save As or Open With
        > dialog?
        >
        > Connection manager -- or XHR for that matter -- is not the right
        > mechanism to accomplish the described task - to throw a "Save As" dialog.
        >
        > Attempting to request binaries via connection manager/XHR will result
        > in a binary stream which is problematic at best.

        What I would do is to have your success handler create a download
        link, ala what Google video does after you choose the type. Instead
        of returning the file, put the file into a temporary storage and
        create a file download script that sets the "Content-Disposition"
        header to "attachment; filename=<put a filename here>".
      Your message has been successfully submitted and would be delivered to recipients shortly.