Now this has been seriously ill-leading. Problem was a wrong parameter sent to the app which would reply with incomplete html, thus the code was (correctly...) not finding the divs I was looking for :)
Thus the coffeescript above is correct.
Question
I have this code:
$ = $root.cheerio.load(body)
results = $('#selector').map (index, element)->
items = []
$(this).find('.item_link').each (i, el)->
console.log("asdf")
items[i] = $(this).attr('title')
result=
name: $(this).find('.the_name_link').attr('title')
#HERE I'd like to do something with items but it's not working
return result
return callback(null,results)
So when this code is executed, there's basically no error, and in my interface I get a result with
[
{
"name": "The Name I was looking for"
}
]
But it seems the code in the each block never gets executed (there's no console output 'asdf'). What am I doing wrong?
Solution
Now this has been seriously ill-leading. Problem was a wrong parameter sent to the app which would reply with incomplete html, thus the code was (correctly...) not finding the divs I was looking for :)
Thus the coffeescript above is correct.