Ajax div update to insert JS for subsequent asynchronous request to external site
I managed to solve this by escaping one more character and removing one semicolon.

In the 2nd argument of ajax_command_html I was attaching a string which had two script tags, one inner and one outter. The inner closing script tag wasn't being passed unless I escaped its forward slash, like this:

&lt;\/script&gt;


Lastly, I had to remove the semicolon that was following "(jQuery)", just prior to closing the outter script tag, like this:

})(jQuery)&lt;/script&gt;');


Hopefully this can be of use to someone!