如何设置文件名以及来自asp.net C#项目的Jquery函数的路径 [英] how to set filename along with path to the Jquery function from asp.net C# project

查看:37
本文介绍了如何设置文件名以及来自asp.net C#项目的Jquery函数的路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有存储在根目录ChatFiles文件夹中的文件,并希望使用asp.net的标签分配给jquery函数。假设我的文件路径是~ChatFiles / abc.html,我将它存储到Label来自数据库的lblFileName,那么如何将它分配给jquery函数。我已尝试使用以下代码,但它抛出了文件路径未找到的异常,所以我怎么能解决这个问题,我的代码是...



Hi,I have file that stored into the root dirctory ChatFiles folder ,and want to assign to jquery function using label of asp.net.Suppose my file path is "~ChatFiles/abc.html",I Stored it to Label "lblFileName" from database,So how to assign it to jquery function.I have tried with following code but it throws exception that 'File path does not found',so how could i solve this,My code is...

function loadLogRefresh(){  
  
 var FileName = $('#<%=lblFileName.ClientID %>').text();

        $.ajax({
            url: FileName ,
            cache: false,
            success: function(html){       
                $("#chatboxRefresh").html(html); //Insert chat log into the #chatboxRefresh div              
            },
        });
    }





那我怎么能得到确切的文件路径并传递给jquery函数



So how could i get exact path of file and pass to jquery function

推荐答案

' #<%= lblFileName.ClientID%>')。text();
('#<%=lblFileName.ClientID %>').text();


.ajax({
url:FileName,
cache: false
成功: function (html){
.ajax({ url: FileName , cache: false, success: function(html){


#chatboxRefresh)。html(html); // 将聊天记录插入#chatboxRefresh div
},
});
}
("#chatboxRefresh").html(html); //Insert chat log into the #chatboxRefresh div }, }); }





那么我怎么能得到确切的文件路径并传递给jquery函数



So how could i get exact path of file and pass to jquery function


这篇关于如何设置文件名以及来自asp.net C#项目的Jquery函数的路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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