This content has been marked as final. Show 10 replies
You can do it with AJAX, sending a query to the DB every X seconds or minutes and having a variable with the last record ID in the table. If after querying the DB, the record ID is higher, then you have new records inserted.
ok thanks i have never used ajax, do you know where i can find some example code to do what i need
A quick search for Coldfusion Ajax example in google turned up a plethora of choices. This one looked appropriate:
In addition to straight up ajax, there are a number of framewords that make creating ajax calls a little more user friendly. Popular choices on this forum are Adobe's Spry framework and CFAjax.
ok thanks i have had i look, i understand the coldfusion code but i am not sure about the js file.
do you know the exact code i would need in the js file to do what i need?
There is another option of using SOAP & Dynamic HTML. You have to write a component in VB that will retrive the data from your database and return back. The method in the VB has to be exposed and SOAP WSDL configured. You can use MS SOAP toolkit to built the WSDL for your component if you are not used to it.
If you are not familiar with all these write a <IFRAME> with no border in your page and this frame content will refresh every minute to get the content what you want. Really the user will not know you are refreshing the page as the iframe will be small and only a part of your page.
ok thanks i have tried the iframe way, but when the page refreshes i get a page click sound
so every 60 secs i get a click sound
can i get rid of this?
You can do it without AJAX. You have to run some code anyway to insert the record, so put the icon up after the insert.
If you are doing the insert in an iframe or popup, put the icon on your main page inside a div tag and make it invisible. Use inner html to make that tag visible after you run your insert.
ok i found some code to stop the click sound, but when my page refreshes now i get a white page.
i am tring to code if query recordcount = 0 the show background red else show background image, so i am not sure why i am getting a white page?
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<CFIF ShowInbox.recordcount GT 0>