【发布时间】:2014-02-03 12:17:00
【问题描述】:
我正在玩一些 phantomjs 和 coffeescript,在访问他的页面中已经有 jquery 的网站后,我想要实现的是触发一些 ajax get 请求,这些请求应该 把数据还给我。我玩过一些 Firefox 控制台,效果非常好。不幸的是,phantomjs 什么也没返回,我也不知道为什么。
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()
谢谢。求帮助。
xaver
【问题讨论】:
标签: jquery ajax coffeescript