I have a casperJS script that returns JSON when run on the command line. I want to have a scheme such that 1) I create a web page 2) When a button is clicked on a web page, casperJS scripts are executed on the server side and send / return the result back to the web page.
How can I do the same.
EDIT: I invoke the AJAX process written in php when I click on buttom. PHP script contains
echo exec('casperjs sample.js');
It didn’t answer anything, but when checking the web server error log I got an error
'casperjs' is not recognized as an internal or external command,
operable program or batch file.
PS: it works fine through the command line.
EDIT2
I changed the PHP script to: The
echo exec('C:\casperjs\batchbin\casperjs .\sample.js');
error was changed to:
'phantonjs' is not recognized as an internal or external command,
operable program or batch file.