Forum Moderators: coopster
Josh
[edited by: eelixduppy at 7:32 pm (utc) on Feb. 20, 2008]
[edit reason] no signatures, please [/edit]
there could be two methods to accomplish your task as described below,
1 - make a php page which reads the id and fetches related record and print it; call your javascript function in the intervals and send id to the php page, read back the output and display it on the page assigning values to DIV etc...
2 - make a php page that reads all the records and print it using a 'splitter' symbol e.g pipe key (¦) e.g
echo "$rec1" . "¦" . $rec2 . "¦" .. and so on
then use split() function of javascript, similar to explode of php, and make an array of the php page output... then in intervals reads the next array value by simply calling the javascript function with a parameter in which you sends it the current array index and then increment by 1 to pick the next element
How about giving it your best attempt [webmasterworld.com] first and we go from there?
BEGIN
DEFINE a variable A with NULL
QUERY DATABASE TO GET RESOURCE(OPT: any conditions)
START LOOP
concatenate using PIPE KEY (¦) all values in A
END LOOP
DISPLAY A
END
When you display the information on php page, your javascript STATE 4 event is called automatically, if not getting it please start ajax from start, then do something like following
JAVASCRIPT:
var ress
function handleHttpResponse() {
if (http.readyState == 4) {
if(http.status==200) {
results=http.responseText;
ress = results.split('¦')
alert(results)
ress now has the values in the form of an array