Hello I fiddle with the marvelous MIT Inventor and the WebViewer
the HTML and Java Script code works fine, but not see Code Snippet
The Problem is after the parsing of Json.
function Test2(Value)
{
$('#demo').html('---> Do I receive Data from the MIT App <---'); // This works
document.getElementById("MITb").innerHTML = "Test Test"; // This works
var JsonObj = JSON.parse(Value); // I parse my JSon
var a = JsonObj.Temperature;
var b = JsonObj.Humidity;
$('#MITb').html(b); // this does not work anymore
document.getElementById("MITb").innerHTML = "Test Test"; // this does not work anymore
I figured out google charts is causing the Problem
then I can't parsing Values
google.charts.setOnLoadCallback(drawMeterPower1);
function drawMeterPower1() {
var data = google.visualization.arrayToDataTable([
['Label', 'Value'],
[vTitle1, Power1],
// ['Power 1', 150],
]);
var options = {
width: 300, height: 125,
min : 0, max : 500,
redFrom: 300, redTo: 500,
yellowFrom:150, yellowTo: 300,
greenFrom:0, greenTo: 150,
minorTicks: 1
};
i have restricted the problem
this still works
JsonObj = JSON.parse(JsonDummy1);
but this is causing the Problem
Power1 = JsonObj.Temperature;
but only with google charts
Is it possible that the JSON itself is corrupt, which causes the parse to throw? Consider wrapping the JSON.parse() call in a try...catch construct and see if the other code runs correctly.
You are right, it was a Json problem but not the Json Text I forgot the stupid var in
JsonData = window.AppInventor.getWebViewString();
in Javascript
I tested it with google chrome without a problem but filally I found this stupid odd problem
You are just a nice Lad Thank you very much ewpatton.
PS I have a chronic Pain disease in my face that makes it not easy to focus but Gadgets like this
is fun to fiddle with. Thank you again