1
I’m uploading some data from an external file (.txt
) local using AJAX, I would like to know how I can store this data in a global variable for data manipulation, because I need to separate some information and allocate it in tables.
NOTE: this page will be executed locally.
Below is the code I’m using.
<html>
<head>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script type="text/javascript">
var temp;
temp = 100;
var intervalo = window.setInterval(altura, temp);
function altura()
{
var divh = document.getElementById("DataText").offsetHeight;
window.scrollBy(0,divh)
};
$(function()
{
setTime();
function setTime()
{
$('#DataText').load("https://textuploader.com/151x2");
setTimeout(setTime, temp);
}
});
</script>
</head>
<body>
<table border="1">
<tr>
<th>Cabeçalho</th>
<th>Outro Cabeçalho</th>
<th>Outro Cabeçalho</th>
</tr>
<tr>
<td>linha 1, célula 1</td>
<td>linha 1, célula 2</td>
</tr>
<tr>
<td>linha 2, célula 1</td>
<td>linha 2, célula 2</td>
</tr>
</table>
<div id="DataText" style="width: 200px; font-size: 10px;"></div>
</body>
</html>
Any help is welcome.....
– Leonardo Silva