开发者

jquery: is there a way to read all files from the host directory?

im just brainstorming an interface that dynamically generates a page based on files located in page's directory. I'm wondering if jquery ca开发者_StackOverflow中文版n 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.


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜