Executing [removed] injected by innerHTML after AJAX call

前端 未结 11 1601
误落风尘
误落风尘 2020-11-22 05:02

There\'s a div called \"Content\":

It should be filled with data from a PHP file, by AJAX, including

11条回答
  •  攒了一身酷
    2020-11-22 05:38

    If you are injecting something that needs the script tag, you may get an uncaught syntax error and say illegal token. To avoid this, be sure to escape the forward slashes in your closing script tag(s). ie;

    var output += '<\/script>';
    

    Same goes for any closing tags, such as a form tag.

提交回复
热议问题