Reputation: 2596
Is there a way to incorporate
$.get("http://localhost/?action=post", { site: "Test" } );
On the server side with PhantomJs and Jquery?
includeJs() and injectJs() don't seem to do anything but throw errors.
Also:
I have tried using regular Javscript on the server side, too:
var xhr = new XMLHttpRequest();
var page = "http://localhost";
var params = "action=post&site=ipsum";
xhr.open("GET",page+"?"+params, false);
xhr.send();
No luck that way either:
xhr.open("GET",page+"?"+params, false);
Notice how I have the third parameter, async, set to "false"--- nothing happens when set to "true"!
Any ideas?
Upvotes: 1
Views: 3276
Reputation: 113
I can't add comment to DMoses's answer, so I share my opinion as an answer here.
To translate web security setting mentioned by DMoses, you can use phantomjs --web-security=no yourjsfile.js
.
Notice, this syntax works under macOS, but not viable within Ubuntu 16.04; with web security disabled in phantomjs execution, ubuntu still gives out 'CORS not supported' error. I am wondering if the option --web-security=no
is not working under Ubuntu.
Upvotes: 0
Reputation: 5858
A quick google shows me they support cross domain request with the command line --web-security=false
found here https://github.com/ariya/phantomjs/wiki/API-Reference
Upvotes: 4