Within your php code you simple run the echo commmand with the Javascript code you wish to execute. If you intend to provide other php ajax responses that are not intended to run Javascript code, the best way to do this is simply prepend the echo response with js:
for example
echo json_encode("js:alert();");.
The json_encode()
is required to prevent a javascript error because ajax is expecting a json repsonse.
Then within the Javascript code that handles the ajax response ...