Please guys, some help
Below is some of my python code and associated Javascript in html
battling to print tot_cnt, cnt and the data array to a html table.
Below is some of my python code and associated Javascript in html
battling to print tot_cnt, cnt and the data array to a html table.
# app.py # Background process to update the Delivery data def background_thread_eft_del(): while True: socketio.sleep(10) timeC = time.strftime('%Y/%m/%d %H:%M:%S') # Dummy data, to be replaced by Oracle_CX DB queries delivery = {'cnt': 2, 'tot_cnt': 40, 'ds': [['row1',4,9], ['row2',6,2], ['row3',20,98], ['row4',4,9], ['row5',6,0]] } delivery_json = json.dumps(delivery) socketio.emit('eft_delivery_update', {'timeC': timeC, 'delivery': delivery_json, 'debug_level': debug_level}, namespace='/eft') #and the JS code and associated html #dashboard.html [html] // Lets update the Delivery table socket.on('eft_delivery_update', function(msg) { var timeC = msg.timeC var debug_level = msg.debug_level var delivery = msg.delivery var delivery_cnt = msg.delivery.cnt var delivery_tot_cnt = msg.delivery.tot_cnt if (debug_level > 0) { console.log(delivery) } $('#timeC').text( timeC ); $('#delivery_cnt').text( delivery_cnt ); $('#delivery_tot_cnt').text( delivery_tot_cnt ); $('#delivery').append('<tr><td>' + $('<div/>').text( delivery ).html() ); }); <table id="EFT_Verticals"> <th><h2>Delivery: <span id="del_cnt"></span>/<span id="del_tot_cnt"></span></h2></th> <th><h2>Load: <span id="load_cnt"></span>/<span id="load_tot_cnt"></span></h2></th> <th><h2>Validate: <span id="validate_cnt"></span>/<span id="validate_tot_cnt"></span></h2></th> <th><h2>Rec Completed: <span id="rec_compl_tot_cnt"></span></h2></th> <tr> <td valign="top"> <table border="1" id="delivery"> </table> </td> <td valign="top"> [/html]G