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.
-
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– Chris Pickett2011-08-22 20:57:17 +00:00Commented Aug 22, 2011 at 20:57
2 Answers
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.
1 Comment
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.