Jquery phantomjs和ajax请求
我正在玩一些phantomjs和coffeescript,在访问一个在他的页面中已经有jquery的站点之后,我想要实现的是触发一些ajax get请求,这些请求应该 把数据还给我。我玩过一点firefox控制台,效果非常好。不幸的是,phantomjs没有返回任何东西,我不知道为什么Jquery phantomjs和ajax请求,jquery,ajax,coffeescript,Jquery,Ajax,Coffeescript,我正在玩一些phantomjs和coffeescript,在访问一个在他的页面中已经有jquery的站点之后,我想要实现的是触发一些ajax get请求,这些请求应该 把数据还给我。我玩过一点firefox控制台,效果非常好。不幸的是,phantomjs没有返回任何东西,我不知道为什么 page = require('webpage').create() system = require 'system' url = 'http://www.testpage.com' #page.includ
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('\n')
phantom.exit()
thks。为了帮助沃尔克
xaver我认为这是因为您必须等待phantomjs完成页面加载。您可以看到以下提示: