Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/89.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery phantomjs和ajax请求_Jquery_Ajax_Coffeescript - Fatal编程技术网

Jquery phantomjs和ajax请求

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

我正在玩一些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()
thks。为了帮助沃尔克


xaver

我认为这是因为您必须等待phantomjs完成页面加载。您可以看到以下提示: