Home  >  Q&A  >  body text

python - django cannot get front-end parameters?

Parameters passed from the front end:

The back-end code obtains parameters for query:

def download_workorder(request):
    # 组装excel表格
    if request.method == 'GET':
        phone = request.GET.get('phone',None)
        iden_num = request.GET.get('iden_num',None)
        status = request.GET.get('status','2000')

        print(phone,iden_num,status)
     


#status The data sent from the front end is not obtained, and it is still the default value. I'd like to ask what could be the reason?

The above is the value passed by ajax from the front-end colleague, but it was not obtained.

The following is what I directly pieced together to access in the browser:

http://127.0.0.1:8000/workorders/download?status=2001&phone=13122001480&iden_num=9915

The URL results obtained the parameters, printed request.GET, and successfully downloaded the form

I would like to ask, is it possible that the data was lost when we transferred it to the front and back ends?

过去多啦不再A梦过去多啦不再A梦2676 days ago880

reply all(1)I'll reply

  • 某草草

    某草草2017-06-22 11:53:28

    Why do I see something wrong with the question mark in your URL? Are you sure it is an English question mark?

    reply
    0
  • Cancelreply