
Originally Posted by
Admum
My hope is that the Div would reload from the web server. Any new text with in that Div would be displayed in place of the original code.
Ah right, I think I understand what you mean now 
This isn't something that would be possible in the way that you described, simply "doing something" to a div won't be able to get the updated version from the server.
However, we can use AJAX to make a request to the server to do this. In this case it would be best if your back-end developer (or yourself of course) would add a little script that would return the title/caption of the current stream.
If this is not an option then we can still make this work, we'll just have a slightly higher overhead.
Firstly, I'll recommend that we use the jQuery library for this as it will save a lot of hassle in the long run.
To include it, if it isn't already, place this before you reference/use it:
Code:
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
First use case: We have a separate script that can give us the title and caption:
Code javascript:
function updateContent() {
$.get("someScript.php", function(data) {
$("#streamTitle").html( data ); // assuming the only string returned is the title
});
}
setInterval(updateContent, 300000);
If this is not an option for you, but you know the current page when retrieved from the server will have the correct title in side the #streamTitle div, we can do it the following way:
Code javascript:
/*
we need to use an element inside streamTitle as the entire element is returned (otherwise you'd end up nesting #streamTitle)
Let's imagine we had the following HTML:
<h1 id="streamTitle"><span id="streamTitleCaption">Hello</span></h1>
*/
function updateContent() {
$("#streamTitle").load("currentpageName.php #streamTitleCaption");
}
setInterval(updateContent, 300000);
Bookmarks