抓取 Ajax 数据只需找到正确的 URL,然后找出解析响应的正确方法:
require 'nokogiri'
require 'open-uri'
require 'json'
# you can find the ajax url in your browser's network tab, or use a debugging proxy like charles or fiddler
ajax_url = 'http://financials.morningstar.com/ajax/ReportProcess4HtmlAjax.html?&t=GE®ion=usa&culture=en-US&cur=USD&reportType=is&period=12&dataType=A&order=asc&columnYear=5&rounding=3&view=raw&r=356282&callback=jsonp1371870522408&_=1371870527498'
response = open(ajax_url).read
# here's how you parse jsonp data
json = JSON.parse response[/{.*}/]
# the html is in a field called result
doc = Nokogiri::HTML json['result']
doc.css("#data_i84") # now you should see it.