1

Im a beginner of javascript and ajax. and i would like to use ajax to populate my tag with which are the content of a particular directory.

is there such opendir() fxn in ajax just like in php? Where do i start from here?

JCm
  • 1,919
  • 8
  • 27
  • 42
  • Do you want to scan directories on the *visitors* computer, or your server? The first won't be possible due to the nature of Javascript which does not provide any Filesystem functions. The second would require a serverside script. – Lekensteyn Nov 11 '10 at 07:55
  • on my server.. what do you mean by a server side script? i am running the page on the server itself sir. – JCm Nov 11 '10 at 08:07

2 Answers2

1

Since you use ajax to access PHP, you can start with a simple ajax request and return the scandir results.

A quick guide for beginners can be found in this question, which should start you on your way.

Community
  • 1
  • 1
Ben
  • 54,723
  • 49
  • 178
  • 224
0

No, there is no way to list files in either a server or client directory. You can make a server wrapper script for this, but it may be better to approach it at a higher level (e.g. return a list of resources, while not exposing the implementation of a resource).

Matthew Flaschen
  • 278,309
  • 50
  • 514
  • 539