P
P
Platon Fedorovich2015-10-08 09:58:49
JavaScript
Platon Fedorovich, 2015-10-08 09:58:49

How to create an array from the data received from multiple $.getJSON() for further use in a jQuery script?

hello world!

Is it possible to do this in jQuery? Here is the starting script: jsfiddle.net/gumuptfb/8

In it I get the data of the sharing counter from the VK, FB and Twitter APIs and round them up (with the addition of kand Mif they are outside the specified limits). I would like to write these received numbers to an array (or some global variable) before rounding them up , in order to use them later (in another place in the script). For example, to calculate the sum and construct the output condition for another piece of code.

Yes, you can withdraw the amount if you just take what is in and span.vkadd up (span.fbspan.twvar d = a + b + c). The problem is that if the received value is greater than 999, then the rounding function will be applied to it and the sum cannot be obtained in this way.

Help me please.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Ukolov, 2015-10-08
@alexey-m-ukolov

You have everything right, actually done, you just use (output to the console) the total array before it is filled.
How can I make a function run only after another one has completed?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question