簡體   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