cannot get the dynamic input value
cannot get the dynamic input value
wwquestion
Posts: 2Questions: 1Answers: 0
Javascript
var table = $('#itemTable').DataTable({
"lengthMenu": [ [5], [5], ],
"processing": true,
"serverSide": true,
"serverMethod": 'post',
"ajax": {
'url':'/jsitemlist/' ,
'type': 'POST',
'data':{p_mcode : $("#m_item_code").val(), },
},
$("#btnsearch").on('click', function(event){
console.log('btn search---'+$("#m_item_code").val()); // can show the value
table.draw();
});
but at the jsitemlist ( flask module ),
def jsitemlist():
print( request.form['p_mcode'] ) # no value display.
Any idea what wrong on this code ? thanks a lot.
Edited by Kevin: Syntax highlighting. Details on how to highlight code using markdown can be found in this guide
This question has an accepted answers - jump to answer
Answers
Likely the problem is you need to use
ajax.data
as a function for dynamic values. Otherwise you will continually send the value that Datatables initialized with. See this example.Kevin
problem solved, thank you a lot.