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

598Re: [json] Re: problem to sending variable.

Expand Messages
  • V. Karthik Kumar
    Nov 30, 2006
    • 0 Attachment

      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.


      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]
    • Show all 5 messages in this topic