Passing variable from function to html body...

S

S. Cole

Hi,

Can someone help me pass a variable from a function in a header to the
body of an html page.

Header Code:
function doLoad()
{
xml = new XMLHttpRequest();

xml.onreadystatechange = function()
{
var elem = null;
var rss_url = null;
var edgerssfeed = null;
var settings = null;
var rssData = null;

if( xml.readyState == 4 )
{
settings =
xml.responseXML.documentElement.getElementsByTagName( 'edgerssfeed' );

for( var c = 0; c < settings.length; c++ )
{
rss_url = settings[c].getElementsByTagName( 'url' )
[0].textContent;

elem = document.createElement( 'div' );
elem.innerText = rss_url;
document.getElementById("edge_rss_feed").appendChild( elem );
rssData = new Spry.Data.XMLDataSet(rss_url, "rss/channel/item");
}
}
}

xml.open( 'GET', 'settings.xml', true );
xml.send( null );
}



body code:
<div spry:region="rssData">
<table width="100%">
<tr spry:repeat="rssData">



I've left a few things out, but this is the basics of it..


Basically I need to pass the rssData variable from the function to the
SPRY:REPEAT (SPRY:REGION) code in the html body.

If I put the:
rssData = new Spry.Data.XMLDataSet(rss_url, "rss/channel/item");

by itself and not in a function (with rss_url = the actual url) it
works.

Many thanks,
Shannon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,159
Latest member
SweetCalmCBDGummies
Top