Inserting JavaScript in the .innerHTML does not cause it to run.
I have what I call a mini-feed in which a user submits a post. This initiates an ajax call which saves
You're right, innerHTML
will not do that, if you want to dynamically create a script tag, you will need to use document.createElement
to create a script tag, but that has all of the same wonderful security bonuses associated with eval
.
Here's another idea, though. Wouldn't it be better to have some function defined in the main page which, after appending anything new, sets the date to "pretty" mode without needing to have the AJAX response know anything about it?