Search code examples
htmlajaxperlstripping

Perl AJAX stripping html characters out of string?


I have a Perl program that is reading html tags from a text file. (im pretty sure this is working because when i run the perl program on the command line it prints out the HTML like it should be.) I then pass that "html" to the web page as the return to an ajax request. I then use innerHTML to stick that string into a div.

Heres the problem: all the text information is getting to where it needs to be. but the "<" ">" and "/" are getting stripped.

any one know the answer to this?


Solution

  • The question is a bit unclear to me without some code and data examples, but if it is what it vaguely sounds like, you may need to HTML-encode your text (e.g. using HTML::Entities).

    I'm kind of surprized that's an issue with inserting into innerHTML, but without specific example, that's the first thing which comes to mind