52,788
社区成员




$(".shiji").click(function () {
var fileName = $(this).attr("id");
$.ajax({
type: "post",
url: "Index.aspx/Existence",
data: "{'Name':'"+fileName+"'}",
success: function (response, status, xhr) {
alert(response);
}
});
});
[WebMethod]
public static bool Existence(string Name)
{
string fileName = Name + ".doc";
string path = HttpContext.Current.Server.MapPath(string.Format(@"File\{0}", fileName)); //获取文件所在位置
if (File.Exists(path))
{
return true;
}
else
{
return false;
}
}
$(".shiji").click(function () {
var fileName = $(this).attr("id");
$.ajax({
type: "post",
url: "Index.aspx/Existence",
dataType:"json",
data: "{'Name':'"+fileName+"'}",
success: function (response, status, xhr) {
alert(response);
}, error: function (response) {
alert(response);
}
});