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

737Re: JSON with HTML snippet

Expand Messages
  • weilandaj
    Feb 14, 2007
    • 0 Attachment
      I'm using the php json extension.

      http://us3.php.net/manual/en/function.json-encode.php

      It generates exactly what I pasted in my first message. After it gets
      eval()'ed it gets mangled. I did some more testing and one thing that
      stood out is "href" seems to get yanked out for some reason in the
      eval. Not sure if that's some kind of security thing


      --- In json@yahoogroups.com, "shalini israni" <shaliny.i@...> wrote:
      >
      > How are you constructing the JSON object on the serverside before u
      send it
      > to the client side? I feel something is mucking up there... Could u
      paste
      > that code??? I'm not into php...but maybe someone else on the group
      is... :)
      > No sweat..it'll get solved!
      >
      > On 2/14/07, weilandaj <weilandaj@...> wrote:
      > >
      > > Hi All,
      > >
      > > I'm having some trouble with an element of my web application with
      json.
      > >
      > > The short story is I am sending database as part of an ajax request.
      > > One piece of that data is HTML text. On the server end I'm using php
      > > with smarty templates and need to send a short bit of HTML that comes
      > > from a template.
      > >
      > > The problem is the html snippet is being severely mangled on the
      > > browser end (tested in IE and FF). Here's an example:
      > >
      > > {"html":"<a href=\"4427-New-Gaming-Channel.html\"\>New Gaming
      > > Channel</a\><b\> . 8 Views</b\>","id":"4427"}
      > >
      > > The HTML becomes:
      > >
      > > <a ew-Gaming-Channel.html">New Gaming Channel</a><b> . 8 Views</b>
      > >
      > > I've tried all sorts of escaping and other things. I'm really stuck
      > > as to why this happens.
      > >
      > > Thanks for you help.
      > >
      > >
      > >
      >
      >
      >
      > --
      >
      > Shalini
      >
      >
      > [Non-text portions of this message have been removed]
      >
    • Show all 7 messages in this topic