J
Jake Barnes
I'm helping to build a site where people recovering from addiction are
suppose to able to share their stories with each other, and encourage
each other toward greater sobriety. One idea that the client had was a
"Sharing Wall" where the posts fade in and fade out and are
constantly replaced. This was suppose to be achieved through Ajax. If
people don't have Javascript on, then they simply read the first 6
posts which appear on the front of the site. But if Javascript is on,
then every 20 seconds each of 6 posts gets updated. You can get a
sense of the front page here:
http://www.bluewalldev.com/secondroad/index.php
The site is still quite rough. The designer is working on it right
now, so things might be crazy when you look at it.
For my part, I'm using the Prototype library to make calls against
this page:
http://www.bluewalldev.com/secondroad/api.php?choiceMade[]=showRandomCommunityPost
Hit refresh on that page a few times. You'll see it serves a different
post each time.
Here is my problem. Prototype fetches text and assigns it using
innerHTML. The text I'm fetching contains Javascript. Is there any
easy way to bring this Javascript to life? Perhaps using eval()?
Is there any easy way to turn text into elements that belong to the
DOM?
I'm normally comfortable building new elements to a page using DOM
friendly methods, but in this case, I can't think how to get this
information from the database and wrap it in HTML and Javascript in a
way that doesn't simply kill performance.
I suppose I could try to fetch the needed info as XML, but it seems
like it would be an amazing amount of work to turn that XML into the
HTML and Javascript that one sees on this page.
Any suggestions?
suppose to able to share their stories with each other, and encourage
each other toward greater sobriety. One idea that the client had was a
"Sharing Wall" where the posts fade in and fade out and are
constantly replaced. This was suppose to be achieved through Ajax. If
people don't have Javascript on, then they simply read the first 6
posts which appear on the front of the site. But if Javascript is on,
then every 20 seconds each of 6 posts gets updated. You can get a
sense of the front page here:
http://www.bluewalldev.com/secondroad/index.php
The site is still quite rough. The designer is working on it right
now, so things might be crazy when you look at it.
For my part, I'm using the Prototype library to make calls against
this page:
http://www.bluewalldev.com/secondroad/api.php?choiceMade[]=showRandomCommunityPost
Hit refresh on that page a few times. You'll see it serves a different
post each time.
Here is my problem. Prototype fetches text and assigns it using
innerHTML. The text I'm fetching contains Javascript. Is there any
easy way to bring this Javascript to life? Perhaps using eval()?
Is there any easy way to turn text into elements that belong to the
DOM?
I'm normally comfortable building new elements to a page using DOM
friendly methods, but in this case, I can't think how to get this
information from the database and wrap it in HTML and Javascript in a
way that doesn't simply kill performance.
I suppose I could try to fetch the needed info as XML, but it seems
like it would be an amazing amount of work to turn that XML into the
HTML and Javascript that one sees on this page.
Any suggestions?