javascript - Round Values pushed from a JSON with JS -
I'm completely new to JS and I can not tell that I value (round 1 and counter 2) The external files that come with IOCounter.html come with a JSN-structure.
I tried to keep math around at different places, which seemed logical to me - but nothing worked.
Do I have to define Vera, make these goals and write the result in the label?
Thank you for your help.
& lt; Script src = "jQuery-2.1.1.min.js" & gt; & Lt; / Script & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; Label id = "counter1" & gt; 0 & lt; / Label & gt; & Lt; Label id = "counter2" & gt; 0 & lt; / Label & gt; & Lt; / Body & gt; & Lt; Script type = "text / javascript" & gt; $ {Document} .ready (function () {$ .ajaxSetup ({cache: false}); set interval (function () {$ .getJSON ("IOCounter.htm", function (result) {$ ('# counter1' ) .text (result ["counter 1"]); $ ('# counter 2'). Text (result ["counter 2"]);});}, 50);}); & Lt; / Script & gt;
You do not need to define with a work copy. You can:
$ ('# counter1'). Lesson (Math Field (Results ["Counter 1"]));
Comments
Post a Comment