JSFiddle - React, Tailwind, and code Playground
HTML
<div id="ajax"></div>
JavaScript
var scriptThatWorks = [
'<script type="text/javascript">',
'//<![CDATA[<!--',
"alert('Show Alert');",
'//-->]]>'
].join ( "\n" )
var scriptThatFails = [
'<script type="text/javascript">',
'<!--//--><![CDATA[//><!--',
"alert('Show Alert');",
'//--><!]]>'
].join ( "\n" )
function inject( html ) {
$( "#ajax" ).html( html );
}
inject( scriptThatWorks );
inject( scriptThatFails );