The task is to create a web-page, which will show the data (temperature, humidity and date) from the Jasonlist of a local web-server on Raspberry Pi. So, I used a command $.getJSON for it and everything works fine, I see the necessary data, but only in Dreamweaver:( When I try to check it in Browser, the JavaScript is blocked (in Chrome, FireFox etc.). Only I can see it in Internet Explorer, because it allow me to unblock "running Javascript" manually. I tried several things (AJAX, sync, async), but the problem that I'm new in JS and I can't find out a simple thing to solve it. The code is following:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>HomeMatic Measurements</title>
</head>
<script type="text/javascript" src="http://www.tutorialspoint.com/jquery/jquery-1.3.2.min.js"></script>
<script type="text/javascript" language="javascript">
$.getJSON('http://192.168.1.7:8083/fhem?cmd=jsonlist&XHR=1', function(a) {$.each(a.Results, function(i, b) {$.each(b.devices, function(i, c) {$.each(c.READINGS, function(i, d) {
if(d.humidity == undefined){} else {$('#data').append('<p> Humidity: ' + d.humidity )}
if(d.temperature == undefined){} else {$('#data').append('<p> Temperature: ' + d.temperature + '<p> Measured: ' + d.measured )}})})})})
</script>
<body>
<h1>HomeMatic Measurements:</h1>
<div id="data"></div>
</body>
</html>
Looking forward for your feedback. Thank you in advance. Best Regards, Michael.