tags:

views:

46

answers:

2

I like the JavaScript equivalence of the php funtion : echo json_encode(glob("images/*.jpg")) ?>);

is it possible ?

+5  A: 

You can't scan a filesystem with javascript. If your site has empty directory indexing, you can parse the resulting html, and pull out a list of links to images.

In general, you are much better off just putting that php snippet in a file and calling it from javascript.

Byron Whitlock
done it in php... work great... sometimes you have to take the right tool for the right work !
marc-andre menard
+1  A: 

Javascript does not in any way/shape/form directly support file-based I/O, including reading directory contents.

Marc B