Getting Spark Variables with 1 Json Call?


#1

I have 7 variables I need to call frequently and I was wondering why I can not seem to get all the vars at once. I need to call my proxy and json for EACH variable. Somebody enlighten me.

 requestURL = "proxy.php?airtemp_f";
    $.getJSON(requestURL, function(json) 
    {
         console.log(json);
         document.getElementById("air_temp").innerHTML = json.result + "° F";
    });

#2

Why not make one Spark variable that returns a string (char array) that has a JSON with all your variables and values in it? That way you just JSON.parse() the return value.


#3

I have failed miserably at doing strings with spark .Heck even my FLOATS spit vicious errors but I love the idea and will try it a bit later


#4

Having now modified my code I have to say I hate that I have to take all my very clear and precise variables and mash them up into one array which I have to split up to display on my HTML5 page.

There must be plans to allow us to poll all variables at one time? @harrisonhjones any thoughts? A simple, Device ID call which returns the last value of the vars is much nicer.


#5

I’m not entirely sure if such a function is in the pipeline.

Perhaps I can help you out with serializing the variables into a string and decoding them on the other side. Can I see some code?