function handleFileSelect(evt) {
var files = evt.target.files// FileList object
// Loop through the FileList
for (var i = 0, ff = files[i]i++) {
var reader = new FileReader()
// Closure to capture the file information.
reader.onload = (function(theFile) {
return function(e) {
// Print the contents of the file
var span = document.createElement('span')
span.innerHTML = ['洞困举<纳碧p>',e.target.result,'</p>'].join('')
document.getElementById('尺春list').insertBefore(span, null)
}
})(f)
// Read in the file
//reader.readAsDataText(f,UTF-8)
//reader.readAsDataURL(f)
reader.readAsText(f)
首先,我有个.js文件,里面有json格式的数前槐世据,下面是该JS内容。
a.js
({"IP":"192.168.1.1","price":"120"},{"IP":"192.168.1.2","price":"200"})
然后我需要用jquery读取该文件明唯以取得数据
window.onload = (function(){
alert("1")
try{$.getJSON("慧肢a.js",
function(data){
alert("load")
})
}catch(e){}})</script>
有alert("1")动作,无alert("load")动作。不知为何
IIS为7.5
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)