0

In my application i have a folder with this structure:

images/
       city1/
             1.jpg
             2.jpg
             ...
       city2/
             1.jpg
             2.jpg
             3.jpg
             ...
       city3/
             1.jpg
             ...

how can i load dynamically files without knowing their number in folder? If I use a for cycle i must know the number but i red that in javascript i cannot read file in folder.

Salvatore Ucchino
  • 717
  • 1
  • 8
  • 17
  • http://stackoverflow.com/a/11489764/1771795 – Omar Dec 19 '13 at 11:29
  • @Omar thanks, but a file `.php` may work on client-side? – Salvatore Ucchino Dec 20 '13 at 09:58
  • collect them and send them as JSON. – Omar Dec 20 '13 at 10:11
  • @Omar i have followed the topic you post but it doesn't work for me. maybe i wrong something. I created `counter.php` file and placed it into my application root. the file contains this code `` and in my `.js` file i call it with `$.get` in this way `var url = data.src; $.get("counter.php", {path: url}, function(result){// some code});` if i print with an alert the result, it returns me the code instead of value..what error am i doing? – Salvatore Ucchino Jan 07 '14 at 12:20
  • use `console.log` to show retrieved array. `function(i, result)`. also try `$.getJSON()`. – Omar Jan 07 '14 at 12:27
  • @Omar however i think that is impossible that a php file work without a server, this is a mobile application client-side only..can be that when i call the $.get() the php code does not run? – Salvatore Ucchino Jan 07 '14 at 13:19
  • Maybe, you need to find away to communicate this on server-side and client-side. – Omar Jan 07 '14 at 13:53

0 Answers0