JSFiddle - React, Tailwind, and code Playground
HTML
<div><button id="ajax">works</button>
<button id="mybutton">works again</button>
<div id="output"></div>
</div>
JavaScript
function makeAlert() {
jQuery('#output').html('script here<'+'script>alert("hi")</s' + 'cript>')
}
jQuery(function() {
jQuery('#mybutton').click(makeAlert);
jQuery('#ajax').click(function() {
jQuery.post('.', {}, function(resp) {
console.log(resp);
makeAlert();
})
})
})