Inside the below job.js
node script how can i call /getJobs
.Am using following way but getting $ is not defined.
在下面的job.js节点脚本里面我如何使用以下方式调用/ getJobs .Am但是没有定义$。
job.js
var jobScedule = function (time, jobid) {
var params = {
"id": jobid
};
$.get('/getJobs', params, function (data) {
console.log(data);
});
}
script.js
.......
......
switch(context.pathname) {
case '/getJobs':
testUtils.runTest(context);
break;
}
1 个解决方案
#1
1
You need request module. It will help you to make http requests:
你需要请求模块。它将帮助您发出http请求:
var request = require('request');
request('http://www.google.com', function (error, response, body) {
if (!error && response.statusCode == 200) {
console.log(body) // Print the google web page.
}
})
#1
1
You need request module. It will help you to make http requests:
你需要请求模块。它将帮助您发出http请求:
var request = require('request');
request('http://www.google.com', function (error, response, body) {
if (!error && response.statusCode == 200) {
console.log(body) // Print the google web page.
}
})