Skip to content

Instantly share code, notes, and snippets.

View PriitParmakson's full-sized avatar

Priit Parmakson PriitParmakson

  • Tallinn, Estonia
View GitHub Profile
// Lõik loetakse failist.
type Lõik struct {
Algus punktinimi `json:"a"`
Lõpp punktinimi `json:"l"`
Pikkus float32 `json:"p"`
}
var lõigud []Lõik
func loeLõigud() {
fetch(url)
.then(res => res.json())
.then((data) => {
// $('#Tulemus').text(JSON.stringify(data, null, 4));
if (data.status == "success") {
kuvaAndmed(data);
} else {
$('#Teade').text('Andmepäring ebaõnnestus');
}
}).catch(err => {