php - Adding a row to a table dynamically -


  $ (दस्तावेज़) .ready (function () {var refreshId = setInterval (function () {periodicRefresh () ;}, 9000);})  

  समारोह periodicRefresh () {$ .ajax ({type: 'GET', url: 'शामिल / एजेक्सएक्शन.एफ़पीपी ', डेटा: "एक्शन = डिस्प्लेलेस्टएवेंट", सफलता: फ़ंक्शन (msg) {var newid = $ (msg) .attr ("id"); वर्तमान = $ ("# सूची tr: प्रथम")। (0) .आईडी; अगर (न्यूड! = वर्तमान फ्प्रर्रो) {$ ("# सूची")। प्रीपेड (msg); पिछलेरो = चालू -19; $ ('#' + आखिरी) .remove ();}}}) ; }  

तालिका की पंक्ति किस तरह दिखती है इसका एक उदाहरण यहां है:

  & lt; tr id = "5094" style = "background: white;" & gt; & Lt; td वर्ग = "tdstd" & gt; & Lt; / टीडी & gt; & Lt; / टीआर & gt;  

यह जानने के लिए थोड़ा मुश्किल है, कैसे पता नहीं कैसे XML " AjaxActions.php "और आपके AJAX कॉल स्वरूपित है। इसके अलावा, मैं यह सोच रहा हूं कि "currentfirstrow" एक वैश्विक जावास्क्रिप्ट परिवर्तनीय है जो कि किसी भी फ़ंक्शन के अंदर पहुंच योग्य है?

  फ़ंक्शन कालिक रीफ्रेश () {$ .ajax ({type: 'GET', url: ' /ajaxActions.php ', डेटा: "action = displayLastEvent", सफलता: फ़ंक्शन (xml) {var newfirstrow = $ (xml) .find ("name_of_xml_node_that_contains_newly_returned_id")। पाठ (); अगर (newfirstrow! = Currentfirstrow) {// नई पंक्ति जोड़ें ()}},}  

Comments

Popular posts from this blog

MySql variables and php -

php - Laravel - Overriding a resource route into a different route filter group -

url rewriting - How to implement the returnurl like SO in PHP? -