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

Problem with Prototype's JSON Implementation and Ajax.Request.

Expand Messages
  • Pradeep
    Hello All, I am a rookie in Web Technologies and had to do a small work with Prototype s json and Ajax.request functions. I had problems with the json.js
    Message 1 of 5 , Apr 30, 2007
    • 0 Attachment
      Hello All,

      I am a rookie in Web Technologies and had to do a small work with
      Prototype's json and Ajax.request functions.

      I had problems with the json.js available in here -
      http://www.json.org/json.js (Ajax.request fails). So had to use the
      Prototype's json implementation.

      I found out that prototype.js uses eval on the input String given. As
      we all know that this is not secure is there any workaround for this
      within the protoype and json libraries?

      Thanks,
      Pradeep
    • Philip Tellis
      ... It would help if you could say what problems you had with json.js
      Message 2 of 5 , Apr 30, 2007
      • 0 Attachment
        Sometime Today, Pradeep assembled some asciibets to say:

        > I had problems with the json.js available in here -
        > http://www.json.org/json.js (Ajax.request fails). So had to use the
        > Prototype's json implementation.

        It would help if you could say what problems you had with json.js
      • Douglas Crockford
        ... Since you are a rookie, I m guessing that your problem is that you are not writing your for..in loops correctly. See
        Message 3 of 5 , Apr 30, 2007
        • 0 Attachment
          --- In json@yahoogroups.com, "Pradeep" <prad_kris@...> wrote:
          > I am a rookie in Web Technologies and had to do a small work with
          > Prototype's json and Ajax.request functions.
          >
          > I had problems with the json.js available in here -
          > http://www.json.org/json.js (Ajax.request fails). So had to use the
          > Prototype's json implementation.
          >
          > I found out that prototype.js uses eval on the input String given. As
          > we all know that this is not secure is there any workaround for this
          > within the protoype and json libraries?

          Since you are a rookie, I'm guessing that your problem is that you are
          not writing your for..in loops correctly. See
          http://yuiblog.com/blog/2006/09/26/for-in-intrigue/
        • Pradeep
          Hello Crawford, I am not using any for..in loops. I went on to find the exact problem using Script Debugger. It was reported in the Rails Bug Tracker. Please
          Message 4 of 5 , Apr 30, 2007
          • 0 Attachment
            Hello Crawford,

            I am not using any for..in loops. I went on to find the exact problem using Script Debugger. It was reported in the Rails Bug Tracker. Please find the link below:
            http://dev.rubyonrails.org/ticket/6579

            Also the information in Prototype's site acknowledges this. (http://prototypejs.org/learn/json)

            My primary need is to work with Ajax.Request and when I use the original json.js of yours, the request doesnt get completed.

            So, I decided to use Prototype's json which uses only the eval and is not supporting parseJSON as in your library. I was wondering there are any workarounds for this situation without using the patches given in the Rails tracker.

            Hope its clear. Please revert for any clarification.

            Thanks,
            Pradeep
            Douglas Crockford <douglas@...> wrote: --- In json@yahoogroups.com, "Pradeep" <prad_kris@...> wrote:
            > I am a rookie in Web Technologies and had to do a small work with
            > Prototype's json and Ajax.request functions.
            >
            > I had problems with the json.js available in here -
            > http://www.json.org/json.js (Ajax.request fails). So had to use the
            > Prototype's json implementation.
            >
            > I found out that prototype.js uses eval on the input String given. As
            > we all know that this is not secure is there any workaround for this
            > within the protoype and json libraries?

            Since you are a rookie, I'm guessing that your problem is that you are
            not writing your for..in loops correctly. See
            http://yuiblog.com/blog/2006/09/26/for-in-intrigue/






            ---------------------------------
            Ahhh...imagining that irresistible "new car" smell?
            Check outnew cars at Yahoo! Autos.

            [Non-text portions of this message have been removed]
          • Douglas Crockford
            ... problem using Script Debugger. It was reported in the Rails Bug ... Interesting. Prototype contains a known bug which is trivial to fix, and they are
            Message 5 of 5 , May 1, 2007
            • 0 Attachment
              --- In json@yahoogroups.com, Pradeep <prad_kris@...> wrote:
              > I am not using any for..in loops. I went on to find the exact
              problem using Script Debugger. It was reported in the Rails Bug
              Tracker. Please find the link below:
              > http://dev.rubyonrails.org/ticket/6579

              Interesting. Prototype contains a known bug which is trivial to fix,
              and they are refusing to apply the fix. That strikes me as completely
              irresponsible.

              There are lots of Ajax libraries out there. I recommend that you pick
              a better one.
            Your message has been successfully submitted and would be delivered to recipients shortly.