ボタンをクリックすると、Jquery Ajax ポスト コールが行われますが、ビューでは値が取得されません。コードは次のとおりです。
jquery:-
$("#startSimulator").click(function(){
test = $("#testRange").val();
gameKey = ($('input:radio[name=radioGroup]:checked').val() || 0);
$("#imageLoading").css("display", "block");
$.post("/blackout/setup/",{d : d,test : test,gameKey : gameKey}, function(data){
$("#result").append(data);
});
});
urls.py:
urlpatterns = patterns('',
(r'^blackout/setup/$', 'blackout.views.setup'),
)
ビュー.py:
def setup(request):
gameKey = request.POST['gameKey']
test = request.POST['test']
data = request.POST['d']
#Some other code
#And then HttpResponse(data)
エラー:-
Exception Value:
"Key 'gameKey' not found in <QueryDict: {}>"
/home/dhruv/blackout_new_project/blackout/blackout_proj/blackout/views.py in setup
gameKey = request.POST['gameKey']