A New Chapter for MagicMirror: The Community Takes the Lead
Read the statement by Michael Teeuw here.
Read the statement by Michael Teeuw here.
How to load config data from file?
-
@acimail01 Ok, we can fix the
$ is not defined at loadJSON
.Replace the function with the following which uses good old XMLHttpRequest:
fuction loadJSON(filePath) { if (typeof module !== "undefined") { return require(filePath); } else { try { var xmlhttp = new XMLHttpRequest(); xmlhttp.open("GET", filePath, false); xmlhttp.send(); if (xmlhttp.status === 200) { return JSON.parse(xmlhttp.responseText); } else { throw "Unexpected status code!"; } } catch (e) { console.error(e); return {}; } } }
-
Did you manage to make this work? I’m trying to do kinda the same.
Thanks