Does $words_unedited contains correct string to put into ' '?
In google chrome open tools -> developer tools. New windows will appear, go to resources and find file that contains this JS code. It should say if there was an error. If there was no error then click that button of yours so it executes your JS function and then see if an error occurs.
An easier way to check if this is a syntax error is to change
$words_unedited = $info['cz'];
$words_unedited = "If you can see this then there is a syntax error.";