0
$.ajax({
type :'GET',
url : geturl(a),
// type: $(this).attr('method'),
dataType : 'json',
views.py:爲什麼我的Django request.method不匹配POST
if request.method=="POST":
if request.POST.get('monyrsubmit'):
monthform=MonthForm(request.POST)
if monthform.is_valid():
selected_month=monthform.cleaned_data["Month"]
selected_year=monthform.cleaned_data["Year"]
print selected_month
print selected_year
我可以有GET和在阿賈克斯的類型字段POST請求。即時通訊使用表格,只有當提交按鈕被點擊時,我試圖根據提交的數據顯示信息。如果request.POST.get('monyrsubmit')不起作用。 幫助將不勝感激
想必你已經使用'型嘗試過嗎?您在Firebug或Chrome Inspector網絡面板中看到什麼?我最好的猜測是你正在碰到Django的CSRF保護。 – 2013-02-19 09:59:00