I have this very simple code to read the response from the server endpoint after the mail request. In fact, I save the data in the database and wait for a response before moving on to the next step.
casper.open('http://example.com/ajax.php, {
method: 'POST',
data: {
'title': '<title>',
'unique_id': '<unique_id>'
}
});
in ajax.php file I am trying to perform a POST ping in a simple way. this will make it easy for me to know if I get the correct answer from the server.
echo json_encode($_POST);
I tried these snippets, but I can not get the answer.
casper.on('page.resource.received', function(resp){
this.echo(JSON.stringify(resp, null, 4));
});
casper.on('http.status.200', function(resp){
this.echo(JSON.stringify(resp, null, 4));
});
casper.on('resource.received', function(resp) {
this.echo(JSON.stringify(resp, null, 4));
});
source
share