im just brainstorming an interface that dynamically generates a page based on files located in page's directory. I'm wondering if jquery can do this? For instance, a page just displays information for each file, maybe a thumbnail, etc. If i were to drop a new file into that directory, the page would show it.
Asked
Active
Viewed 354 times
1
-
3Not really doable with just JavaScript. JavaScript runs on the client (not to mention that it has no file access), so you'd still need some way of getting the contents of the directory on the server. I suppose you could do it if indexes were enabled on the server, then you could parse that with js. – Chris Pickett Aug 22 '11 at 20:57
2 Answers
4
Jquery is a library written in javascript that basically runs on client browser. So if you want to working with server (host), you need to communicate with server via Ajax or other techniques. Jquery, however, does not have an ability to read files in the server.

Tae-Sung Shin
- 20,215
- 33
- 138
- 240
-
I didn't think so. I'll look into having an asp page generate the necessary information in JSON so that I can make an ajax call and create the page based on the "result" page. Thanks – Sinaesthetic Aug 23 '11 at 07:34
2
Pure client-side Javascript can't do this by design (it would be a serious security hole); it would need to be able to speak to the server. It would be possible to write a server-side app that can return the contents of the directory, which Javascript would be able to send AJAX GET requests to pull out and display.

Michael Louis Thaler
- 1,854
- 2
- 15
- 19