diff --git a/app.py b/app.py index 2f96d60..1aa53ca 100644 --- a/app.py +++ b/app.py @@ -132,8 +132,6 @@ def updateduplicate(): aud = request.form.get('auditory_dubl') - - @app.route('/vneaud', methods=['GET', 'POST']) def vneaud(): res = [] @@ -180,6 +178,36 @@ def zamsearch(): for item in searchedZam: zam.append([item.txtzam, item.created_date]) return render_template('zametki.html', zam=zam) + + +@app.route('/addraspved', methods=['GET', 'POST']) +def addraspved(): + if request.method == 'POST': + query_string = request.data + # Convert the bytes object to a string + query_string_str = query_string.decode("utf-8") + + # Split the query string by '&' to get individual key-value pairs + key_value_pairs = query_string_str.split("&") + + # Create a dictionary to store the key-value pairs + query_dict = {} + for pair in key_value_pairs: + key, value = pair.split("=") + query_dict[key] = value + + # Retrieve the values for specific keys + rasp_value = query_dict.get("rasp") + ved_value = query_dict.get("ved") + + print(f"Value for 'rasp': {rasp_value}") + print(f"Value for 'ved': {ved_value}") + + + + return jsonify({'success': True}, 200, {'ContentType': 'application/json'}) + + # ================================================================================== diff --git a/static/js/searchonaud.js b/static/js/searchonaud.js index bdd8b2b..1e1b6e4 100644 --- a/static/js/searchonaud.js +++ b/static/js/searchonaud.js @@ -1,43 +1,44 @@ - $("#searchbutton").click(function(){ - - const audid = document.getElementById('auditory') +function getData(){ + const audid = document.getElementById('auditory') + $.ajax({ - $.ajax({ + url: "/searchonaud", + type: "get", + contentType: 'application/json', + dataType: 'json', + data: { + auditory: audid.value + }, - url: "/searchonaud", - type: "get", - contentType: 'application/json', - dataType: 'json', - data: { - auditory: audid.value - }, + success: function(response){ + var data = response; + const table = document.getElementById('datatable') + table.innerHTML = '' + var headTable = '
| Номер в Инв. вед | Инв. номер | Название | Аудитория | +Расположение | + {% for item in res: %}