Thursday, 16 March 2017

jQuery is not defined

I have this script,which is used to crawl the web:

var noodle = require('noodlejs');

var query = {
    url: 'http://google.com/search?q=javascript',
    type: 'html',
    selector: 'h3.r a',
    extract: 'text'
  },
  uriQuery = encodeURIComponent(JSON.stringify(query)),
  request  = 'http://example.noodlejs.com/?q=' +
             uriQuery + '&callback=?';

// Make Ajax request to Noodle server
jQuery.getJSON(request, function (data) {
  console.log(data[0].results);
});

and i'm getting this error:

ReferenceError: jQuery is not defined
    at Object.<anonymous> (C:\Users\user\Desktop\node.js program\test.js:23:1)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.runMain (module.js:604:10)
    at run (bootstrap_node.js:394:7)
    at startup (bootstrap_node.js:149:9)
    at bootstrap_node.js:509:3

what's wrong?

thanks in advance.



via OiRc

No comments:

Post a Comment