Hi,
I use un array with 2 values string1 and string2
string1 is outside request (call before request module)
string2 inside request module
How can i get my variable string2 using module request
I try, global, it doesn't work well
Thanks for you help
Eric
...
for (var j = 0, len = arr.length; j < len; j++) {
...
var obj2 = JSON.parse(arr[j]) ;
console.log(obj2.string1 + ' : ' + obj2.string2) ;
// string1 string2 are OK
// string1 is used to build the url, OK
...
request(string1, function (error, response, html) {
// request use string1, OK
if (!error && response.statusCode == 200) {
var $ = cheerio.load(html);
$('td.event-favourite').each(function(i, element){
var a = $(this);
...
var z1 = 'test :' + string2
// string2
string2 contains the last value