I am not so clear where exactly you would want to “inject” this JS .
"After a new comment has been made"
, in WP terms and php workflow, can mean several things . (for example when the $POST request is made , when the action is triggered ,when it is getting checked, sanitized , when it is inserted to the DB etc etc ..)
Anyhow ,you will need to search for the right wp actions / filters that you can hook into , like the comment_post
action ( unfortunately undocumented in codex – GIYBF ) ,or the comment_post_redirect
filter (Also undocumented in codex) or wp_insert_comment
action (runs AFTER comment inserted to DB) and use those actions to include the JS ..
for example :
add_action ('comment_post','my_comments_js_function');// runs when comments are POSTED
and then
my_comments_js_function(){
// do your JS stuff.
}
But like I said, it is not really clear to me what exactly you want and WHEN .