OsakaWebbie
Programmer
I am using PHP on the server-side to pass database data back to Javascript via JSON, and sometimes I'll need to pass the same data back and forth a couple times (while various user feedback is requested to finalize it), but finally, it will go in the database as regular data and on the page as "innerHTML" content. But I'm having problems with newlines - of course if I put one in the JSON string as is, the eval() gives an "unterminated string literal" error, but the strange thing is that even if I change the newlines to "<br />" when constructing the JSON, eval() still gives the same error. Does Javascript really interpret "<br />" as a newline internally? If so, what should I use to represent newlines? I haven't even yet worried about how to get it back to the server-side once it's been transformed to something that Javascript likes - I figured I'd cross that bridge when I come to it - but if someone has been down this road and has a method for making a round-trip with the data, that's a bonus.
(In case any of you notice this same question on the Javascript forum... I did not initially double-post, but was "sent" here after posting there.)
(In case any of you notice this same question on the Javascript forum... I did not initially double-post, but was "sent" here after posting there.)