diff --git a/app.py b/app.py index 8b652cc..dd04fc7 100644 --- a/app.py +++ b/app.py @@ -189,23 +189,21 @@ def addraspved(): if request.method == 'POST': #b'rasp=asndhaslkj&ved=1111111&inv=18124' query_string = request.get_data().decode() - un_query_string = unquote(unquote(query_string)) + un_query_string = unquote(unquote(query_string)).split('&') - print(un_query_string.split('&')) query_dict = {} - for pair in un_query_string.split('&'): + for pair in un_query_string: key, value = pair.split("=") query_dict[key] = value + print(query_dict) ob = db.session.query(Oboruds).filter_by(invNumber=query_dict['inv']).first() - print(ob) ob.raspologenie=query_dict['rasp'] ob.numberved = query_dict['ved'] db.session.commit() - - - - return jsonify({'success': True}, 200, {'ContentType': 'application/json'}) + db.session.close() + + return jsonify({'success': True}, 200, {'ContentType': 'application/json'}) # ================================================================================== diff --git a/static/js/searchonaud.js b/static/js/searchonaud.js index abfe949..f5c6fea 100644 --- a/static/js/searchonaud.js +++ b/static/js/searchonaud.js @@ -47,15 +47,12 @@ function tableclick(x){ let datas = x.innerText.split('\t') - - - $('#getmodal').modal('show') - let rasp = document.getElementById('rapolog') - let vedomost = document.getElementById('vednumber') + //let rasp = document.getElementById('rapolog') + //let vedomost = document.getElementById('vednumber') let invnom = document.getElementById('modal_invnom') - let matcen = document.getElementById('modal_matcenn') + //let matcen = document.getElementById('modal_matcenn') invnom.innerText=datas[1]+"\t" matcen.innerText=datas[2].substring(0,15) @@ -76,8 +73,6 @@ function tableclick(x){ } ) $('#modalsavetodb').click(function(){ - - $.ajax({ url: "/addraspved", @@ -89,16 +84,15 @@ function tableclick(x){ ved: vedomost.value, inv: datas[1] }, - + success:function() { + rasp.value = ''; + vedomost.value= ''; + data=[]; + rasp + $('#getmodal').modal('hide'); + getData(); + } }) - rasp.value = ''; - vedomost.value= ''; - - datas = []; - - $('#getmodal').modal('hide'); - - getData(); }) } diff --git a/templates/searchonaud.html b/templates/searchonaud.html index 67bf3ff..97fa8ce 100644 --- a/templates/searchonaud.html +++ b/templates/searchonaud.html @@ -9,7 +9,7 @@