I'm playing a bit with phantomjs and coffeescript, what I want to achieve after visiting a site which in his page has already jquery is to fire some ajax get requests which should return me the data. I've played a bit with firefox console and works really nice. Unfortunately phantomjs doesn return nothing and I don't know why.
page = require('webpage').create()
system = require 'system'
url = 'http://www.testpage.com'
#page.includeJs("http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js")
page.open url,
(status) ->
if status isnt 'success'
console.log 'uanble to acces the netzwprk'
else
results = page.evaluate ->
all = []
list = $(".navigation .main")
for item in list
all.push(item.href)
#return all
$.get item.href, (data,status) ->
console.log data.toSource()
#console.log results.join('
')
phantom.exit()
thks. for help volk.
xaver
I think it's because you have to wait for phantomjs to finish loading the page. you can see this for some hints: https://code.google.com/p/phantomjs/issues/detail?id=265