HTML(3)
-
Flask: update form value at JavaScript code
A form can be updated wih the new value at JavaScript code by accessing the form's id through DOM tree element. {{ form.hidden_tag() }} {{ form.name.label(class="form-control-label") }} ... in the HTML code, name form has its DOM element id as 'name'. Thus, in the JavaScript code, 'name' is used as DOM element id. function update_info(data) { document.getElementById('name').value = data.name .....
2021.08.14 -
JavaScript, HMLT: changing color of selected row in table
... function onRowSelected(target) { var tbody = target.parentNode; var trs = tbody.getElementsByTagName('tr'); var bg_color = "#ffffff"; var text_color = "black"; var sel_bg_color = "#82B27D"; var sel_text_color = "#ffffff"; var upm_id = ""; var upm_name = ""; for (var i = 0; i
2021.08.14 -
JavaScript: AJAX call w/ Flask
JavaScript side First thing, you need to do to make an AJAX call from JavaScript is just adding ajax call code using jQuery as follow. AJAX server side At Flask server, what we need to implement to receive the POST request from client side is adding a new route function. from flask import Flask, render_template, jsonify, request app = Flask(__name__) @app.route('/') def index(): return render_te..
2021.08.14