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

problem to sending variable.

Expand Messages
  • prashant_shah09
    Hi, how to send javascript variables from one domain to another by JSON ?
    Message 1 of 5 , Nov 29, 2006
      Hi,

      how to send javascript variables from one domain to another by JSON ?
    • Douglas Crockford
      ... In the short term, you can use a technique such as this: http://www.xml.com/lpt/a/2005/12/21/json-dynamic-script-tag.html Be very careful though because it
      Message 2 of 5 , Nov 30, 2006
        > how to send javascript variables from one domain to another by JSON ?

        In the short term, you can use a technique such as this:
        http://www.xml.com/lpt/a/2005/12/21/json-dynamic-script-tag.html

        Be very careful though because it is terribly insecure. It should only
        be used if you fully trust the server.

        We need a less dangerous alternative. I suggest that we should have a
        new transport mechanism like JSONRequest
        http://json.org/JSONRequest.html. If you agree, write to your favorite
        browser maker, and tell them you want JSONRequest.
      • prashant shah
        Thanks, but there i didn t find my solution. Actually i want to do some calculation in javascript file and send the value through variable. How can i set this
        Message 3 of 5 , Nov 30, 2006
          Thanks,
          but there i didn't find my solution. Actually i want to do some calculation in javascript file and send the value through variable. How can i set this variable to JSON value and send JSON data to other domain ?
          one more thing right now how many browsers support JSONRequest ?


          Douglas Crockford <douglas@...> wrote:
          > how to send javascript variables from one domain to another by JSON ?

          In the short term, you can use a technique such as this:
          http://www.xml.com/lpt/a/2005/12/21/json-dynamic-script-tag.html

          Be very careful though because it is terribly insecure. It should only
          be used if you fully trust the server.

          We need a less dangerous alternative. I suggest that we should have a
          new transport mechanism like JSONRequest
          http://json.org/JSONRequest.html. If you agree, write to your favorite
          browser maker, and tell them you want JSONRequest.






          ---------------------------------
          Access over 1 million songs - Yahoo! Music Unlimited.

          [Non-text portions of this message have been removed]
        • V. Karthik Kumar
          Hi, What you d ideally do is, eval() or parse the json string into a javascript object. Then perform changes on it. Then serialize it back to a string, and use
          Message 4 of 5 , Nov 30, 2006
            Hi,

            What you'd ideally do is, eval() or parse the json string into a
            javascript object. Then perform changes on it.
            Then serialize it back to a string, and use XHR.

            The problem is usually that it isn't safe to send requests to another
            domain, because of cross site scripting issues.
            Because of this, most browsers don't allow you to do this by default. So
            it doesn't matter if you got the data by dyamic <script>
            generation or XHR, but sending it back will definitely be a problem.

            What i'd suggest is, keep a proxy page on your own server which forwards
            these requests to the other domain.

            Regards,
            Karthik

            prashant shah wrote:
            >
            > Thanks,
            > but there i didn't find my solution. Actually i want to do some
            > calculation in javascript file and send the value through variable.
            > How can i set this variable to JSON value and send JSON data to other
            > domain ?
            > one more thing right now how many browsers support JSONRequest ?
            >
            >
            > Douglas Crockford <douglas@...
            > <mailto:douglas%40crockford.com>> wrote:
            > > how to send javascript variables from one domain to another by JSON ?
            >
            > In the short term, you can use a technique such as this:
            > http://www.xml.com/lpt/a/2005/12/21/json-dynamic-script-tag.html
            > <http://www.xml.com/lpt/a/2005/12/21/json-dynamic-script-tag.html>
            >
            > Be very careful though because it is terribly insecure. It should only
            > be used if you fully trust the server.
            >
            > We need a less dangerous alternative. I suggest that we should have a
            > new transport mechanism like JSONRequest
            > http://json.org/JSONRequest.html. <http://json.org/JSONRequest.html.>
            > If you agree, write to your favorite
            > browser maker, and tell them you want JSONRequest.
            >
            > ---------------------------------
            > Access over 1 million songs - Yahoo! Music Unlimited.
            >
            > [Non-text portions of this message have been removed]
            >
            >
          • mertsakarya@hotmail.com
            Other Domain is an issue, if you are working on internet. There is also a solution of creating a IFRAME. But I believe most of the members of this group
            Message 5 of 5 , Nov 30, 2006
              "Other Domain" is an issue, if you are working on internet.

              There is also a solution of creating a IFRAME. But I believe most of the members of this group doesn't favor this solution. Having a page that makes requests to other domain on server-side is a better solution.

              Mert


              ----- Original Message -----
              From: prashant shah
              To: json@yahoogroups.com
              Sent: Friday, December 01, 2006 6:24 AM
              Subject: Re: [json] Re: problem to sending variable.


              Thanks,
              but there i didn't find my solution. Actually i want to do some calculation in javascript file and send the value through variable. How can i set this variable to JSON value and send JSON data to other domain ?
              one more thing right now how many browsers support JSONRequest ?


              Douglas Crockford <douglas@...> wrote:
              > how to send javascript variables from one domain to another by JSON ?

              In the short term, you can use a technique such as this:
              http://www.xml.com/lpt/a/2005/12/21/json-dynamic-script-tag.html

              Be very careful though because it is terribly insecure. It should only
              be used if you fully trust the server.

              We need a less dangerous alternative. I suggest that we should have a
              new transport mechanism like JSONRequest
              http://json.org/JSONRequest.html. If you agree, write to your favorite
              browser maker, and tell them you want JSONRequest.

              ---------------------------------
              Access over 1 million songs - Yahoo! Music Unlimited.

              [Non-text portions of this message have been removed]





              [Non-text portions of this message have been removed]
            Your message has been successfully submitted and would be delivered to recipients shortly.