JSON 84 (258)
10.3 Example
This example shows how to create a web page that fetches Module Name and CPU load from
the module and presents it on the web page. The file, containing this code, has to be stored in
the built-in file system, and the result can be seen in a common browser.
<html>
<head>
<title>Anybus CompactCom</title>
<!-- Imported libs -->
<script type="text/javascript" src="vfs/js/jquery-1.9.1.js"></script>
<script type="text/javascript" src="vfs/js/tmpl.js"></script>
</head>
<body>
<div id="info-content"></div>
<script type="text/x-tmpl" id="tmpl-info">
<b>From info.json</b><br>
Module name:
{%=o.modulename%}<br>
CPU Load:
{%=o.cpuload%}%<br>
</script>
<script type="text/javascript">
$.getJSON( "/module/info.json", null, function(data){
$("#info-content").html( tmpl("tmpl-info", data ) );
});
</script>
</body>
</html>
Anybus
®
CompactCom
™
40 PROFINET IRT Network Guide SCM-1202-023 EN 1.8