1

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.

1
  • 3
    Not 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. Commented Aug 22, 2011 at 20:57

2 Answers 2

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.

Sign up to request clarification or add additional context in comments.

1 Comment

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
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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.