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

Re: Outputing Content-type: application/javascript from CGIDEV2

Expand Messages
  • smit_al
    I m not sure, but wouldn t it be.... Content-type: text/javascript
    Message 1 of 4 , Oct 1, 2009
    • 0 Attachment
      I'm not sure, but wouldn't it be....

      Content-type: text/javascript

      --- In Easy400Group@yahoogroups.com, "soapagent" <jim.watterson@...> wrote:
      >
      > Hi
      >
      > I want to returm some text for an ajax call. The js wants the type identified as
      >
      > Content-type: application/javascript
      >
      > to allow script to execute.
      >
      > When I change my IFS file from
      >
      > <AS400>OUTPUT
      > content-type: text/html
      >
      > /%ajaxout1%/
      >
      > (Which is readable in the browser)
      >
      > to
      >
      > <AS400>OUTPUT
      > Content-type: application/javascript
      >
      > /%ajaxout1%/
      >
      > I get junk in the bowser instead. Lile this
      >
      > щ""¨Ã™ƒ'֙•õщ""¨Ã™ƒ'֙•õ
      > 
      >
      > I'm sure it something to do with cod page transaltion but I can't find a setting that works.
      >
      > Any ideas?
      >
    • Scott Klement
      Hello, The IBM i HTTP server decides whether to convert your data from EBCDIC to ASCII (or vice-versa) based on it s content type. A text content type
      Message 2 of 4 , Oct 1, 2009
      • 0 Attachment
        Hello,

        The IBM i HTTP server decides whether to convert your data from EBCDIC
        to ASCII (or vice-versa) based on it's content type. A text content
        type (text/plain, text/html, text/xml, etc) will be converted from
        EBCDIC to ASCII. Non-text types (application/*, image/*) are not.

        The content-type of application/javascript only makes sense if you are
        outputting JavaScript code. If you really need to build a JavaScript
        program on the fly with CGI, I suggest trying some different settings
        for the CgiConvMode option in Apache. If none work, you could (of
        course) do the translate EBCDIC->ASCII manually. But I'd try
        CgiConvMode first.

        If your data is not actually JavaScript code, but rather is output
        intended to be read by an AJAX script in the browser, then I would
        recommend using text/plain or text/xml.

        This is the first I've ever heard of an AJAX script that requires a
        particular content-type. Is this a framework/toolkit that you're using?
        or is it home-grown?



        soapagent wrote:
        > Hi
        >
        > I want to returm some text for an ajax call. The js wants the type identified as
        >
        > Content-type: application/javascript
        >
        > to allow script to execute.
        >
        > When I change my IFS file from
        >
        > <AS400>OUTPUT
        > content-type: text/html
        >
        > /%ajaxout1%/
        >
        > (Which is readable in the browser)
        >
        > to
        >
        > <AS400>OUTPUT
        > Content-type: application/javascript
        >
        > /%ajaxout1%/
        >
        > I get junk in the bowser instead. Lile this
        >
        > щ""¨Ã™�ƒ'Ö™•õщ""¨Ã™�ƒ'Ö™•õ
        > 
        >
        > I'm sure it something to do with cod page transaltion but I can't find a setting that works.
        >
        > Any ideas?
        >
        >
        >
        >
        >
        >
        >
        > ------------------------------------
        >
        > Yahoo! Groups Links
        >
        >
        >
        >
      • soapagent
        Thanks for the replies. We are using Prototype.js, specifically the Ajax.Request method. This has an option to automatically eval the returned contents if the
        Message 3 of 4 , Oct 1, 2009
        • 0 Attachment
          Thanks for the replies.

          We are using Prototype.js, specifically the Ajax.Request method. This has an option to automatically eval the returned contents if the content-type is one of the "application" variants. We have been using this for some time with a a Java based nackend (using LANSA and LANSA Integrator but our experiments with CGIDEV2 show it be much, much faster.

          If the returned text had been in ascii then the existing function would have worked out of the box!

          That said, I've looked at the latest version of prototype.js and there appears to be a new option of evalJS="force" which might do the job with html/text. Failing that we could add a calback and issue our own eval.

          --- In Easy400Group@yahoogroups.com, Scott Klement <easy400@...> wrote:
          >
          > Hello,
          >
          > The IBM i HTTP server decides whether to convert your data from EBCDIC
          > to ASCII (or vice-versa) based on it's content type. A text content
          > type (text/plain, text/html, text/xml, etc) will be converted from
          > EBCDIC to ASCII. Non-text types (application/*, image/*) are not.
          >
          > The content-type of application/javascript only makes sense if you are
          > outputting JavaScript code. If you really need to build a JavaScript
          > program on the fly with CGI, I suggest trying some different settings
          > for the CgiConvMode option in Apache. If none work, you could (of
          > course) do the translate EBCDIC->ASCII manually. But I'd try
          > CgiConvMode first.
          >
          > If your data is not actually JavaScript code, but rather is output
          > intended to be read by an AJAX script in the browser, then I would
          > recommend using text/plain or text/xml.
          >
          > This is the first I've ever heard of an AJAX script that requires a
          > particular content-type. Is this a framework/toolkit that you're using?
          > or is it home-grown?
          >
          >
          >
          > soapagent wrote:
          > > Hi
          > >
          > > I want to returm some text for an ajax call. The js wants the type identified as
          > >
          > > Content-type: application/javascript
          > >
          > > to allow script to execute.
          > >
          > > When I change my IFS file from
          > >
          > > <AS400>OUTPUT
          > > content-type: text/html
          > >
          > > /%ajaxout1%/
          > >
          > > (Which is readable in the browser)
          > >
          > > to
          > >
          > > <AS400>OUTPUT
          > > Content-type: application/javascript
          > >
          > > /%ajaxout1%/
          > >
          > > I get junk in the bowser instead. Lile this
          > >
          > > щ""¨Ã™ƒ'֙•õщ""¨Ã™ƒ'֙•õ
          > > 
          > >
          > > I'm sure it something to do with cod page transaltion but I can't find a setting that works.
          > >
          > > Any ideas?
          > >
          > >
          > >
          > >
          > >
          > >
          > >
          > > ------------------------------------
          > >
          > > Yahoo! Groups Links
          > >
          > >
          > >
          > >
          >
        Your message has been successfully submitted and would be delivered to recipients shortly.