Xively使用javascript从提要获取数据流列表
我试图获取单个提要中所有数据流的列表,并显示其当前值。我正在使用此处的文档和教程:。我试图在下面编写一个简单的javascript代码,但它不起作用Xively使用javascript从提要获取数据流列表,javascript,xively,Javascript,Xively,我试图获取单个提要中所有数据流的列表,并显示其当前值。我正在使用此处的文档和教程:。我试图在下面编写一个简单的javascript代码,但它不起作用 <html> <head> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script> <script src="http://code.jquery.com/jquery-latest.m
<html>
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script src="http://code.jquery.com/jquery-latest.min.js"></script>
<script src="http://d23cj0cdvyoxg0.cloudfront.net/xivelyjs-1.0.4.min.js"></script>
</head>
<body>
<h1>Xively Test</h1>
<h2>
<small>Datastream list</small>
</h2>
</p>
<script>
xively.setKey("yWYxyi3HpdqFCBtKHueTvOGoGROSAKxGRFAyQWk5d3JNdz0g");
xively.datastream.list(
61916 //id from the tutorial example
, function (data) {
data.results.forEach(function (datastream) {
document.write("<br><br>Datastream ID:"+JSON.stringify(datastream["id"]
document.write("<br><br>Current value:"+JSON.stringify(datastream["current_value"], null, 4));
});
});
</script>
</body>
</html>
十四试验
数据流列表
十四、设置键(“yWYxyi3HpdqFCBtKHueTvOGoGROSAKxGRFAyQWk5d3JNdz0g”);
xively.datastream.list(
61916//id来自教程示例
,函数(数据){
data.results.forEach(函数(数据流){
document.write(“
数据流ID:”+JSON.stringify(数据流[“ID”]
document.write(“
当前值:”+JSON.stringify(datastream[“Current_value”],null,4));
});
});
知道它为什么不起作用吗
谢谢您的javascript中有一些错误
<script>
xively.setKey("yWYxyi3HpdqFCBtKHueTvOGoGROSAKxGRFAyQWk5d3JNdz0g");
xively.datastream.list(
61916 //id from the tutorial example
, function (data) {
data.forEach(function (datastream) {
document.write("<br><br>Datastream ID:"+JSON.stringify(datastream["id"]));
document.write("<br><br>Current value:"+JSON.stringify(datastream["current_value"], null, 4));
});
});
</script>
十四、设置键(“yWYxyi3HpdqFCBtKHueTvOGoGROSAKxGRFAyQWk5d3JNdz0g”);
xively.datastream.list(
61916//id来自教程示例
,函数(数据){
data.forEach(函数(数据流){
document.write(“
数据流ID:+JSON.stringify(数据流[“ID]”));
document.write(“
当前值:”+JSON.stringify(datastream[“Current_value”],null,4));
});
});
您的javascript中有一些错误
<script>
xively.setKey("yWYxyi3HpdqFCBtKHueTvOGoGROSAKxGRFAyQWk5d3JNdz0g");
xively.datastream.list(
61916 //id from the tutorial example
, function (data) {
data.forEach(function (datastream) {
document.write("<br><br>Datastream ID:"+JSON.stringify(datastream["id"]));
document.write("<br><br>Current value:"+JSON.stringify(datastream["current_value"], null, 4));
});
});
</script>
十四、设置键(“yWYxyi3HpdqFCBtKHueTvOGoGROSAKxGRFAyQWk5d3JNdz0g”);
xively.datastream.list(
61916//id来自教程示例
,函数(数据){
data.forEach(函数(数据流){
document.write(“
数据流ID:+JSON.stringify(数据流[“ID]”));
document.write(“
当前值:”+JSON.stringify(datastream[“Current_value”],null,4));
});
});