473,320 Members | 1,846 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Re: putting data into js vars

On Apr 28, 8:31 pm, Jake <j...@never2reply.comwrote:
Hi,

I have the following javascript that receives data from a server-side
push technology. This function receives the data fine and is in an
external *.js file which I import in this web page.

data_event = function(data) {
var data_box = document.getElementById('data_output');
var div = window.parent.document.createElement('div');
div.className = "event";
div.innerHTML = data;
data_box.appendChild(div);
data_box.scrollTop = data_box.scrollHeight;

}

And also in this *.html page, I have the following where the data gets
printed as it arrives. And this works also.

<div id="data_output"></div>

But my problem is that, I want to fill in the data variables below (more
javascript in this same web page) and I don't know how to get it into
these dataX variables.

<script id="source" language="javascript" type="text/javascript">
$(function () {

var data1 = [[4, 8]];
var data2 = [[5, 2]];

// do plotting of data here ...
});
</script>

Can anyone lend a hand here? Any help much appreciated.
Perhaps you are looking for something like this

<URL: http://jibbering.com/faq/#FAQ4_18>

Peter
Jun 27 '08 #1
1 1041
What about using JSON?

http://www.json.org/
Jun 27 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: jerrygarciuh | last post by:
Hello, In this sample script I create an array of objects. Print out their data with print_r().Update their data with a sub called v_set(). Print out data showing the chnages using print_r(). I...
10
by: Scotter | last post by:
Please forgive me for reposting; last title didn't quite say it right. I have an ASP application I wrote in vbScript so this is not .Net. There are 20 nearly identical versions of this...
7
by: wardm | last post by:
I have created a Dict object in a C++ App that calls (embedded) Python functions. The Dict is to be used to pass variable data between the C++ App and the python functions. However I cannot get...
4
by: none | last post by:
i need to interface python with a bitpacked data file, the structure recorded in the file is the following: struct { var_1 4bit var_2 6bit var_3 2bit var_3 4bit }
19
RMWChaos
by: RMWChaos | last post by:
Previously, I had used independent JSON lists in my code, where the lists were part of separate scripts. Because this method did not support reuse of a script without modification, I decided to...
6
by: goodguyjam | last post by:
Hi all, I'm having trouble with mysql. I've just finished my php coding for HTTP authentication and with some help am now getting a login window pop up whenever I click on a link on my website...
162
by: Sh4wn | last post by:
Hi, first, python is one of my fav languages, and i'll definitely keep developing with it. But, there's 1 one thing what I -really- miss: data hiding. I know member vars are private when you...
5
by: Ross | last post by:
Forgive my newbieness - I want to refer to some variables and indirectly alter them. Not sure if this is as easy in Python as it is in C. Say I have three vars: oats, corn, barley I add them...
7
by: Nates | last post by:
I have built a quote engine for the rating of insurance premiums. Each month the rates that generate the premiums change which requires a new database file be created with updated premium tables (we...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.