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

Re: JSON with HTML snippet

Expand Messages
  • xxppmmssttooss
    Hi, i want to use JSON also with HTML snippets. The snippet has included Smarty variables, i use the FCKeditor as wysiwyg-editor. Firstly i found out that the
    Message 1 of 7 , Mar 6, 2007
    • 0 Attachment
      Hi,

      i want to use JSON also with HTML snippets. The snippet has included
      Smarty variables, i use the FCKeditor as wysiwyg-editor.
      Firstly i found out that the quotation mark (") in the HTML snippet
      will destroy the JSON encoded object. I read json.org, and i read the
      control characters (",\,/ etc.) can not be unicode chars like all
      other chars. But i trying to replace the control characters in the
      json-wanted format (\",\\,\/ etc.) and it will not work :(

      But when i replace only the quotation mark (") with the HTML code
      " it will works:

      replace(/"/g, "\"""); (client)
      str_replace('"','"',$foo); (server)

      Only with this change, i can send a little bit HTML code and smarty
      variables (<b>{$foo}</b>,{if $bar}<i>{$bar}</i>{/if}).
      It will works, but not fine!!!

      Sometimes, when i send HTML snippets with this solution, it will
      works, but sometime, i can't decode the JSON object.

      Firstly i think, another character will destroy the JSON object like
      the quotation mark (") before... I can't found another character, when
      it sometimes works, and sometimes not works, with the same HTML
      snippet...

      I need also a solution for sending HTML code (or other programming
      code, css, javascript etc.) with an JSON object for my AJAX application.
    Your message has been successfully submitted and would be delivered to recipients shortly.