tags:

views:

47

answers:

1

I have a script on my website that shows messsages from a mysql database. Now I want to make it so it only pops up one message at a time. Anyone want to shed some light on this?

Windows Vista
PHP - Mysql - Ajax - JS

I can't really provide a code sample but here is some pseudocode:

if(ID == 1)
{ 
// SHOW  ID++;
}

// Show #2 
+1  A: 

Set up a callback that pulls and pops up the new message, then schedules the callback again if a message was successfully pulled and shown.

Ignacio Vazquez-Abrams
+1. Javascript runs synchronously with the browser. It's learning how to make code 'react' to event handlers (when X is done, do Y). Although you need not perform the Ajax sequentially or in lock-step with the display, depending upon other requirements. For instance, the initial-fetch may pulled into a queue or a queue may be filled by a "background" XHR request. The Array type is already well-suited for a queue.
pst