test.php responds with string of Javascript.
Php writes file, responds with filename.