M
Muvels
New member
- Beiträge
- 1
- Punkte Reaktionen
- 0
Probleme bei Integration von AlphaVantage API in Datatables
Hallo alle zusammen, ich versuche mithilfe der Alpha Vantage Api die Kursdaten einer Aktie in eine Datatables Tabelle zu bekommen, mein HTML COde sieht dabei so aus:
Und das ist der dazugehörige Javascript Code
Jedoch werden die Kursdaten nicht in der Tabelle angezeigt, ich habe es auch schon über die CSV Schnittstelle von Alpha Vantage verscuht, das hat aber auch nicht funktioniert, könnte mir jemand sagen wo der Fehler ist ?
Vielen Dank schon mal
PS: Das ist die API abfrage welche in die Tabelle soll:
https://www.alphavantage.co/query?function=TIME_SERIES_WEEKLY_ADJUSTED&symbol=TSCO.LON&apikey=demo
Hallo alle zusammen, ich versuche mithilfe der Alpha Vantage Api die Kursdaten einer Aktie in eine Datatables Tabelle zu bekommen, mein HTML COde sieht dabei so aus:
HTML:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Jquery Datatable</title>
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.19/css/jquery.dataTables.min.css">
</head>
<body>
<table id="example" class="display" style="width:100%">
<thead>
<tr>
<th>open</th>
<th>high</th>
<th>low</th>
<th>close</th>
</tr>
</thead>
<tfoot>
<tr>
<th>open</th>
<th>high</th>
<th>low</th>
<th>close</th>
</tr>
</tfoot>
</table>
<br><br>
<script src="https://code.jquery.com/jquery-3.3.1.js"></script>
<script src="https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js"></script>
</body>
</html>
Und das ist der dazugehörige Javascript Code
Javascript:
<script>
$.ajax({
type: "GET",
url: 'https://www.alphavantage.co/query?function=TIME_SERIES_WEEKLY_ADJUSTED&symbol=TSCO.LON&apikey=demo',
dataType: 'json',
success: function (obj) {
$('#example').DataTable({
data: obj,
columns: [
{data: "1\\. open"},
{data: "2\\. high"},
{data: "3\\. low"},
{data: "4\\. close"}
]
});
},
error: function (obj) {
alert(obj.msg);
}
});
</script>
Jedoch werden die Kursdaten nicht in der Tabelle angezeigt, ich habe es auch schon über die CSV Schnittstelle von Alpha Vantage verscuht, das hat aber auch nicht funktioniert, könnte mir jemand sagen wo der Fehler ist ?
Vielen Dank schon mal
PS: Das ist die API abfrage welche in die Tabelle soll:
https://www.alphavantage.co/query?function=TIME_SERIES_WEEKLY_ADJUSTED&symbol=TSCO.LON&apikey=demo
Zuletzt bearbeitet: