Question

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?

Was it helpful?

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

OTHER TIPS

There could be a mod on the server that is removing special characters. Are you running Apache? (I doubt this is what's happening).

If something is being stripped on the client-side, it is most likely in the response handler portion of the AJAX call. Show your code where you stick the string in the div.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top