PhantomJS: operation canceled when loading a resource via AJAX

This is my code:

page.onResourceRequested = function (requestData, networkRequest) { console.log(requestData.url); // This message shows http://website-with-jquery-included.com/page.html! } page.onResourceError = function(resourceError) { console.log('Unable to load resource (#' + resourceError.id + 'URL:' + resourceError.url + ')'); console.log('Error code: ' + resourceError.errorCode + '. Description: ' + resourceError.errorString); }; page.open('http://website-with-jquery-included.com/', function(status) { if (status === "success") { page.evaluate(function() { console.log('I can see this message'); $.ajax({url: 'http://website-with-jquery-included.com/page.html', success: function(resp) { console.log('I cannot see this message!'); }}); }); } }); 

The page.onResourceError function displays an error message:

Unable to load resource (# 35URL: http://website-with-jquery-included.com/page.html )

Error code: 5. Description: Operation canceled

Why is it canceled? I did not cancel anything manually. It works well in a browser (Google Chrome).

+7
ajax asynchronous phantomjs jquery-callback
source share

No one has answered this question yet.

See related questions:

620
Ajax request returns 200 OK, but an error event is fired instead of success
390
How to submit FormData objects using Ajax queries in jQuery?
79
jQuery Ajax Requests Canceled Without Submission
4
Unable to load page resources using PhantomJS
one
AJAX, Laravel 4.2 - POST status canceled, how to send a message to the route
0
Chrome extension: Error loading resource: net :: ERR_INSECURE_RESPONSE when loading an image using AJAX
0
Unable to open multiple pages in queryselector.click in phantomjs when the link opens in a new window (target = _blank)
0
Phantomjs using page.evaluate outside page.open

All Articles