I am trying to get a table to update from my database. I tried to follow the php manual as he thought it would be very similar, but I can make it work.
I have a separate file that receives data and puts it in a table. Then I try to use Javascript to get the file and update it.
This is my main file.
<module template="../includes/header.cfm" pagetitle = "Jaguar Live Capture"> <div class="container-fluid"> <div class="row-fluid"> <div class="span12"> <h1>Live Capture</h1><br /> <h2>Pen 1</h2> <div id="tableHolder"></div> </div> </div>
This is my getData.cfm
<cfquery name="liveFeed"> SELECT * FROM details LIMIT 0, 10 </cfquery> <style> .oddRow{background:#ffffff;} .evenRow {background: #DBDBDB;} .warn{background:red;} </style> <table cellpadding="2"> <cfoutput query="liveFeed"> <cfif liveFeed.currentRow mod 2><cfset rowstyle = "oddRow"> <cfelse><cfset rowstyle = "evenRow"> </cfif> <cfscript> if (liveFeed.form_id == "" || liveFeed.first_name =="" || liveFeed.surname =="" || liveFeed.email ==""){ rowstyle = "warn";} </cfscript> <tr class="#variables.rowstyle#"> <td onclick="window.open('update.cfm?form_id=#liveFeed.form_id#', 'Update Details', 'width=350, height=350'); return false;">#liveFeed.form_id#</td> <td onclick="window.open('update.cfm?form_id=#liveFeed.form_id#', 'Update Details', 'width=350, height=350'); return false;">#liveFeed.title#</td> <td onclick="window.open('update.cfm?form_id=#liveFeed.form_id#', 'Update Details', 'width=350, height=350'); return false;">#liveFeed.first_name#</td> <td onclick="window.open('update.cfm?form_id=#liveFeed.form_id#', 'Update Details', 'width=350, height=350'); return false;">#liveFeed.surname#</td> <td onclick="window.open('update.cfm?form_id=#liveFeed.form_id#', 'Update Details', 'width=350, height=350'); return false;">#liveFeed.email#</td> </tr> </cfoutput> </table>
I tried several parts of javascript and ajax, but did not succeed. Can someone help me create a script to refresh the page.
Will source share