I have a loop with inner if statements as follows
var html = "";
var i;
for (i = 0; i < products.length; i++)
{
if(products[i].attrs.product_type == type)
{
html += '<p>hello world</p>';
}
}
I'd really like to be able to say if no results are returned from for loop, say "Sorry, no results were found" etc… I've tried the following…
for (i = 0; i < products.length; i++)
{
if(products[i].attrs.product_type == type)
{
html += '<p>hello world</p>' +i;
}
}
But that just puts the object number next to the returned result…
Any help would be great as I'm sure this is very easy
Thanks
ihave to do with no results?