在Firefox中使用j查询读取文件内容 [英] read file content using j query in Firefox

查看:68
本文介绍了在Firefox中使用j查询读取文件内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨。

我正试图从java脚本调用j查询函数。

i想要将文件名传递给

j查询函数它读取文件的内容并返回结果..

一切正常,但是我在firefox中收到错误'read undefined'

函数哪个我打电话是未定义的。

喜欢......







// java脚本函数



hi.
i'm trying to call j query function from java script.
i want to pass file name to
j query function which reads the content of the file and returns the result..
everything works fine for ie but i'm getting error in firefox as 'read undefined'
the function which i'm calling is undefined.
like...



//java-script function

function ReadFile()
{
//some code
var data= read(fileName);
alert(data);
}

//J query function
function read(fileName)
{
               $.get(fileName, function (data) {
                szData = new String(data);
            },"text");
        return szData;
}





------------------





------------------


推荐答案

.get(fileName, function (data){
szData = new 字符串(数据);
}, 文本);
return szData;
}
.get(fileName, function (data) { szData = new String(data); },"text"); return szData; }





------------------





------------------



work在所有浏览器上....





work on all browser....


function ShowReadFilecontent(objFileName) {
        var result;


.ajax({
url :objFileName,
类型:' get'
dataType:' htm'
async: false
成功:功能(数据){
result = data;
}
});
返回结果
}
.ajax({ url: objFileName, type: 'get', dataType: 'htm', async: false, success: function (data) { result = data; } }); return result }


这篇关于在Firefox中使用j查询读取文件内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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