简体   繁体   中英

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

var fileName = ["login", "logout"]; fileName.forEach(function(Value) { $.get('views/'+Value+'.html', function(result) { var title = $(result).find('title').innerHTML;// this is title value }); }); enter code here
$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));
            });
        });

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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