S
S
SpeNch2021-01-24 22:56:48
Node.js
SpeNch, 2021-01-24 22:56:48

How to execute a script command when receiving data?

I make an AJAX request from my site to the server, the server itself returns the code

<div>......
<script>alert(1)</script>

and I insert this received response through document.getElementById("content").innerHTML = response from the server.
and I don’t know why, but this answer is not processed, the div blocks are displayed for me,
and the alert script doesn’t want to, I don’t know what it is connected with, maybe because the page has been processed, HELP

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Somewhere Intech, 2021-01-24
@SpeNch

varscript = document.createElement('script');
script.src = something;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question