获取请求包含filters
数组。如何在后端获取烧瓶请求中的数组。我已尝试logs.info(request.args.getlist('filters[]'))
但无法正常工作。它返回空数组。
检查下面的请求参数。
logs.info(request.args)
[('filters[1][column_name]', u'Entry Time'), ('filters[1][fieldType]', u'date'), ('tech_id_vendor_code', u''), ('filters[2][operator]', u'Does Not Contain'), ('csr_code', u'96456'), ('filters[1][operator]', u'Less than'), ('filters[1][value1]', u'2017-05-11'), ('filters[2][value1]', u'ertert'), ('filters[1][filter_operator_text]', u'Less than'), ('filters[3][fieldType]', u'date'), ('_', u'1496136551815'), ('valid_branch', u'321'), ('filters[0][operator]', u'Contains'), ('filters[3][value1]', u'2017-05-16'), ('filters[3][filter_operator_text]', u'Between'), ('filters[3][operator]', u'Between'), ('filters[0][column_name]', u'Notification Status'), ('filters[3][value2]', u'2017-05-30'), ('filters[2][filter_operator_text]', u'Does Not Contain'), ('filters[0][fieldType]', u'text'), ('filters[0][value1]', u'sert'), ('filters[2][column_name]', u'Confirmation Required'), ('filters[3][column_name]', u'Entry Time'), ('filters[2][fieldType]', u'text'), ('filters[0][filter_operator_text]', u'Contains')]
logs.info(request.query_string)
'_=1496137080269&csr_code=96456&valid_branch=321&tech_id_vendor_code=&filters%5B0%5D%5BfieldType%5D=text&filters%5B0%5D%5Bcolumn_name%5D=Notification+Status&filters%5B0%5D%5Boperator%5D=Contains&filters%5B0%5D%5Bfilter_operator_text%5D=Contains&filters%5B0%5D%5Bvalue1%5D=sert&filters%5B1%5D%5BfieldType%5D=date&filters%5B1%5D%5Bcolumn_name%5D=Entry+Time&filters%5B1%5D%5Boperator%5D=Less+than&filters%5B1%5D%5Bfilter_operator_text%5D=Less+than&filters%5B1%5D%5Bvalue1%5D=2017-05-11&filters%5B2%5D%5BfieldType%5D=text&filters%5B2%5D%5Bcolumn_name%5D=Confirmation+Required&filters%5B2%5D%5Boperator%5D=Does+Not+Contain&filters%5B2%5D%5Bfilter_operator_text%5D=Does+Not+Contain&filters%5B2%5D%5Bvalue1%5D=ertert&filters%5B3%5D%5BfieldType%5D=date&filters%5B3%5D%5Bcolumn_name%5D=Entry+Time&filters%5B3%5D%5Boperator%5D=Between&filters%5B3%5D%5Bfilter_operator_text%5D=Between&filters%5B3%5D%5Bvalue1%5D=2017-05-16&filters%5B3%5D%5Bvalue2%5D=2017-05-30'
使用Ajax请求:
$.ajax({
url: URL,
cache: false,
dataType: 'json',
data: request_params//Object of {csr_code: "96456", valid_branch: "321", tech_id_vendor_code: "", filters: Array[4]}
}).done(function(response) {.....});