> Ok, first off new to jquery and taconite. What I am trying to do is a
> variation of the classic stock ticker display. I have a table that is
> database driven, I want a periodical update of that information. I was
> trying to use prototype to do this but then I came across taconite and
> thought with it's ability to update multiple divs it was right what I
> was after.
> So now that I've given a brief background this is where I am at:
>
> I have a html table poplulated. every updatable element is in it's own
> div
> I want to periodcally query mysql, the "item_id" is the only query
> parameter I need to send so am I on the right track here? And will
> this "fire" for every "item_id" displayed in my table or do I need a
> separate "get" for each one?
>
> $.get('data1.php'); \\ request data
>
> data1.php->
>
> <?php header('Content-type: text/xml');
> $query="select * from table_name where item_id =" & how do I pass the
> necessary item_id?
> ...
> ..
> ?>
> <taconite>
> <replacecontent="#div_bid">
> <?=echo $query_result['current_bid'];?>
> </replacecontent>
>
> <replacecontent="#div_ask">
> <?=echo $query_result['current_ask'];?>
> </replacecontent>
> </taconite>
>
> Going 1 step further, if I am on the right track, how do I make this
> "get" a periodical update?
>
> Thank you in advance for your help. After taking cobol in the 70's,
> this old fart is trying to keep up with all this new-fangled ajax &
> oop et all :)
The Taconite command elements use the "select" attribute to identify
the nodes to update. So try changing your doc around like this:
<taconite>
<replacecontent select="#div_bid">
<?=echo $query_result['current_bid'];?>
</replacecontent>
<replacecontent select="#div_ask">
<?=echo $query_result['current_ask'];?>
</replacecontent>
</taconite>
To fetch the data periodically you can use setInterval.
http://developer.mozilla.org/en/docs/DOM:window.setIntervalSomething like:
setInterval(fetchData, 30000); // fetch every 30 sec
function fetchData() {
$.get('data1.php');
}