Feed a list with data from the txt file

0

Hello, good morning! People need help!

I have the following list created in html, it is not complete, just p you understand.

<ul class="lista">											
	    <li>Datetime:</li>
	    <li>Velocidade:</li> 
	    <li>$ Inicial:</li> 
	    <li>$ Atual: </li>
	    <li>$ Financ: </li>
	    <li>% Neil: </li> 
						

And I have it in JS (I took a tutorial, and I think that's what I need

var numsList = [];
$.ajax( 'Input.txt', {
    dataType: 'text',
    success: function(response){
        //response é o conteudo do Input.txt
        var lines = response.split('\n'); //quebra o arquivo em linhas, 
        for(var i in lines){
            var row = lines[i];
            var nums = row.split(','); //quebra a linha em valores separdos por virgula
            for(var j in nums){
                var num = parseInt(nums[j]); //converte o valor para int
                if( !isNaN(num) ) //basicamente verifica se é um numero
                    numsList.push(num); //adiciona o item no array
            }
        }

        console.log(numsList);
    }
});

I also have a txt file (Input.txt) with some information separated by commas.

What I want is to feed the list with the information from the txt file but put it in the correct position

for example

I have the first item in the Datatime: list and inside it I want to put the first item in the txt file

But I do not know how to call JS in HTML.

Thank you.

    
asked by anonymous 29.08.2018 / 17:14

0 answers