By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,515 Members | 1,178 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,515 IT Pros & Developers. It's quick & easy.

Re: putting data into js vars

P: n/a
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
Share this Question
Share on Google+
1 Reply


P: n/a
What about using JSON?

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

This discussion thread is closed

Replies have been disabled for this discussion.