繁体   English   中英

如何使用 javascript 从不同的文件夹文件和 html 文件名中获取数据

[英]how to Get data from different folder file and that html file name using javascript

var fileName = [“登录”,“注销”]; fileName.forEach(function(Value) { $.get('views/'+Value+'.html', function(result) { var title = $(result).find('title').innerHTML;// 这是标题值 }); }); 在此处输入代码
$scope.Obj = {
    Allcontent: []
};
var ContentName = [];

    $scope.fileName = ["login", "info"];// html file names
    var input = document.getElementById("Myinput");// search box id
    var value = input.value.toUpperCase();
        angular.forEach($scope.fileName, function(Value) {
            $.get('file/'+Value+'.html', function(result) {
                var input, filter, title, i;
                var path = $(result).find('meta').content;
                input = $(result).find('h1').innerHTML.toUpperCase();
                title = $(result).find('title').innerHTML.toUpperCase();
                
                $scope.Obj['Allcontent'].push({"Value":title, "Path":path});
                $scope.Obj['Allcontent'].push({"Value":input, "Path":path});
                
                ContentName.push(title);
                ContentName.push(input);
                ContentName= [ ...new Set(ContentName) ];// for remove duplicate values
                $scope.getContentName= ContentName.filter(el => el.includes(value));
            });
        });

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM