divsis a string, so it divs.lengthwill return the length of this string. You need to convert it to a DOM node, select divs and get a counter:
$('div', '<wrapper>' + divs + '</wrapper>').length;
Alternatively, in the code you provided, you can simply get the length of the data. Array of results:
data.Results.length;
source
share