Here is a snippet of my code:
var jenkins = require('jenkins')('http://192.168.1.5:8080');
var job_name = undefined;
jenkins.job.list(function doneGetting(err, list) {
if (err) throw err;
job_name = list[0].name;
});
jenkins.job.get(job_name, function(err, info){
if (err) throw err;
res.render('index', {
title: 'Jenkins API',
job_name: job_name,
job_info: info
})
});
I am facing an issue where I can't access the value of job_name because it's within the callback function. I've been searching for a solution to this problem but haven't found one yet. I apologize for any redundancy in asking about callbacks.
Thank you for any help in advance.