0
我想按照這個教程與節點和jQuery刮 -與node.js中和jQuery刮
http://net.tutsplus.com/tutorials/javascript-ajax/how-to-scrape-web-pages-with-node-js-and-jquery/
內,他們有一些代碼,內容是這樣的 -
request({uri:"http://events.sfgate.com/search?swhat=&swhen=&swhere=San+Francisco&commit=Search&st_select=any&search=true&svt=text&srss="},function(err,response,body){
jsdom.env({
html: "http://events.sfgate.com/search?swhat=&swhen=&swhere=San+Francisco&commit=Search&st_select=any&search=true&svt=text&srss=",
src:['http://code.jquery.com/jquery-1.6.min.js'],
done: function(errors,window){
console.log("WINDOW");
console.log(window.jQuery);
var $ = window.$;
//other stuff
當我控制檯日誌window.JQuery,或窗口。$,都是未定義的 - 但不應該是因爲jsdom應該將jquery嵌入到頁面中?爲什麼沒有發生?