I have a casperJS script which returns a JSON when run on commandline. I want to have an arrangement such that 1) I create a webpage 2) On clicking a button on the webpage the casperJS scripts gets executed at the server side and post/return the result back to the webpage.
How can i do the same.
EDIT: I am invoking an AJAX process written in php on clicking the buttom. The php script contains
echo exec('casperjs sample.js');
It returned nothing but on checking the webserver error log I got the error
'casperjs' is not recognized as an internal or external command,
operable program or batch file.
PS: It running absolutely fine via commandline.
EDIT2
I changed the php script to:
echo exec('C:\casperjs\batchbin\casperjs .\sample.js');
The error got modified to :
'phantonjs' is not recognized as an internal or external command,
operable program or batch file.