i have to display auto-generated images from a folder in html.
how can i check if file exist in javascript/jquery so i can do a for-loop and display them all. they will be numbered 1.jpg, 2.jpg and so on.
You can probably fire a request and check the HTTP status code (404 for not existing ;))
If You don't like the ajax and checking http status method, there is a HTML-DOM way to do that.
if You put a new img node and add onload - it will fire only when/if image loads.
in jQuery:
var there=$('get where You want to put it');
$('<img />').attr('src',image_link).bind('load',function(){
do whatever You need to do if image loads
}).appendTo(there);
and it starts the function with "do whatever" after image loads.
cheers;)