如何将ajax对象数据传递到python文件

如何将ajax对象数据传递到python文件,python,jquery,Python,Jquery,我已经编写了一个ajax代码来将值传递给python文件。我使用了request.GET['user'],但它给出了编译错误。请帮助我给出python中捕获值的任何方法。 下面是python代码: if (request.session.get('word',None) and request.session.get('user',None)): print "<script type='text/javascript'>console.log('no words submi

我已经编写了一个ajax代码来将值传递给python文件。我使用了request.GET['user'],但它给出了编译错误。请帮助我给出python中捕获值的任何方法。 下面是python代码:

if (request.session.get('word',None) and request.session.get('user',None)):
    print "<script type='text/javascript'>console.log('no words submitted')</script>"
else:
    word=request.GET['word']
    user=request.GET['user']
编译错误:

File "word_to_dictionary_user.py", line 8, in <module>
    word=request.GET['word']
NameError: name 'request' is not defined
文件“word\u to\u dictionary\u user.py”,第8行,在
word=请求。获取['word']
NameError:未定义名称“请求”

该函数似乎没有将
请求
作为参数,但由于您的代码片段不完整,因此无法查明问题所在。

欢迎使用StackOverflow!请提供迄今为止您所掌握的代码,以便更容易地帮助您。包含代码但不包含错误,希望您在回答问题时尽可能多地努力。请将您完整的
word\u发布到\u dictionary\u user.py
文件。
File "word_to_dictionary_user.py", line 8, in <module>
    word=request.GET['word']
NameError: name 'request' is not defined