Created
February 24, 2015 21:31
-
-
Save artjomb/8c65b3431bf537d979e6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var page = require('webpage').create(); | |
var url = 'http://api.jquery.com/jQuery.ajax/'; | |
page.open(url, function (status) { | |
var result = page.evaluate(function(url){ | |
var result = "blah"; | |
$.ajax({ | |
async: false, | |
url: "/", | |
type: 'get', | |
success: function (output) { | |
var parsed_output = $.parseHTML(output); | |
result = ""+parsed_output[0]; | |
} | |
}); | |
return result; | |
}, url); | |
var version = page.evaluate(function(){ | |
return $.fn.jquery; | |
}); | |
console.log(version); // 1.11.2 | |
console.log(result); // [object Text] | |
phantom.exit(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment