cakephp - Mootools 1.3.2 Request.HTML fetch table rows -


first off please don't bash me using old technology (polling) , old version of mootools (1.3.2) don't have control on these factors.

ok here's problem.

i have page refreshes every few seconds fetch new data database via ajax. ideally structure of returned value should such:

<tr>     <td>1</td>     <td>2</td>     <td>3</td>     <td>4</td> </tr> 

after receiving table row structure result, need append current table in page adds new record on table if there new records. if there's none, no changes table made.

currently using

var req = new request.html({url: url_to_get_new_rows,      onsuccess: function(html, responsehtml) {         // append table row 'html' here     } }).send(); 

however, returned value in 'html' variable i'm supposed append @ end of table returns

1 2 3 4 

this undesired behavior need tr , td elements make work.

i hope me problem.

thanks!

javascript:

new request.html({     url:'tr.php',     onsuccess: function(responsetree, responseelements, responsehtml, responsejavascript) {         var tbody = document.id('tbody');          tbody.set('html', tbody.get('html') + responsehtml);         // or         var tr = new element('table', {'html': responsehtml}).getelement('tr');         tr.inject(tbody);     } }).get(); 

html:

<table>     <thead>         <tr>             <th>1</th>             <th>2</th>             <th>3</th>             <th>4</th>         </tr>     </thead>     <tbody id="tbody">         <tr>             <td>a</td>             <td>b</td>             <td>c</td>             <td>d</td>         </tr>     </tbody> </table> 

Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -