Hallo,
Ich habe folgendes Problem, dass auf dem Bild zusehen ist https://prnt.sc/plm4g1 .
Ich möchte, dass Heavy neben Calais - Duisburg (Road) steht.
Code:
Code
div class="card mb-5">
<div class="card-header">
<b>TruckersMP Stats</b>
</div>
<div class="card-body">
<table class="table">
<tbody>
<tr>
<h1></h1><p>Server: Simulation 1</p></tr>
<tr>
<td><div id="tes32"></div>
<section></section>
<script>
function getThem(selHeader, selSection, url) {
function populateHeader(jsonObj) {
var myH1 = document.createElement('h1');
myH1.textContent = jsonObj['squadName'];
header.appendChild(myH1);
var myPara = document.createElement('p');
myPara.textContent = '' + jsonObj.response[0].name
header.appendChild(myPara);
}
var header = document.querySelector(selHeader);
var section = document.querySelector(selSection);
var requestURL = url;
var request = new XMLHttpRequest();
request.open('GET', requestURL);
request.responseType = 'json';
request.send();
request.onload = function () {
var superHeroes = request.response;
populateHeader(superHeroes);
// showHeroes(superHeroes);
}
}
getThem('#tes32', 'section', 'https://api.truckyapp.com/v2/traffic/top?server=sim1&game=ets2')
</script>
</div>
<tr><script src="test.js"></script></tr>
</div></td>
-------------------------- test.js
function getThem(selHeader, selSection, url) {
function populateHeader(jsonObj) {
var myH1 = document.createElement('h1');
myH1.textContent = jsonObj['squadName'];
header.appendChild(myH1);
var myPara = document.createElement('p');
myPara.textContent = '' + jsonObj.response[0].severity
header.appendChild(myPara);
}
var header = document.querySelector(selHeader);
var section = document.querySelector(selSection);
var requestURL = url;
var request = new XMLHttpRequest();
request.open('GET', requestURL);
request.responseType = 'json';
request.send();
request.onload = function () {
var superHeroes = request.response;
populateHeader(superHeroes);
// showHeroes(superHeroes);
}
}
getThem('#tes32', 'section', 'https://api.truckyapp.com/v2/traffic/top?server=sim1&game=ets2')
Alles anzeigen