使用JavaScript检查服务器上的文件是否存在 [英] to check file exists on server using javascript

查看:52
本文介绍了使用JavaScript检查服务器上的文件是否存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的所有


您能否告诉我如何使用javascript

Dear All


Can you please tell me how to check wheather file exists on server using javascript

推荐答案

JavaScript是服务器端技术,并且不了解服务器上的内容,因此无法检查服务器上的存在的文件.服务器直到执行回发.
有一种称为AJAX的技术可以完全满足您的需求.从 Wikipedia [
JavaScript is a client side technology and would know nothing about what''s there on the server until you do a postback.
There is a technology called AJAX which does exactly what you require. Quoting AJAX definition from Wikipedia[^]:
AJAX an acronym for Asynchronous JavaScript and XML is a group of interrelated web development techniques used on the client-side to create asynchronous web applications. With Ajax, web applications can send data to, and retrieve data from, a server asynchronously (in the background) without interfering with the display and behavior of the existing page. Data is usually retrieved using the XMLHttpRequest object. Despite the name, the use of XML is not needed (JSON is often used instead), and the requests do not need to be asynchronous.



网上有很多相同的例子.在Google上搜索"AJAX asp.net"或"jQuery AJAX"(这些天来很多人正在使用jQuery发布信息)开始使用.

希望这会有所帮助!



There are many examples for the same on the web. Search Google for "AJAX asp.net" or "jQuery AJAX" (post using jQuery is what lot of people are using these days) to get started.

Hope this helps!


以Ankur的答案为基础,您可以找到一个很好的示例
Building off of Ankur''s answer, you can find a good example here


同意Ankur和教皇达伦.
AJAX是检查文件存在性的最佳选择.
使用JAVA脚本中的Page.Methods()函数来检查文件的存在.
Agree with Ankur and PopeDarren.
AJAX is the best option for checking file existance.
Use Page.Methods() function in JAVA Script to check existance of file.


这篇关于使用JavaScript检查服务器上的文件是否存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆