Open thinksource opened 11 years ago
Hi, I want to send an ajax request: by $.post javascript code: data='{"jsonrpc": "2.0", "method": "secret", "params": {"a": "as12"}, "id": 1}' $.post( 'RPC2', data, function(data1) { alert("Response: " + data1); } );
the python receive code: @csrf_exempt @jsonrpc_method('app.addStrings(arg1=String) -> String', validate=True) def add(request, secret_data):
print request.COOKIES print request.body re=request.REQUEST print repr(re) result=0; for k in re: print "dict[%s] =" % k,re[k] rep = re.get('params', None) print rep return HttpResponse(json.dumps({'message':'Hello World'}), content_type="application/json")
but I get the 403 Forbiden as CSRF problem. I think I have already writen @csrf_exempt, but it don't work.
Hi, I want to send an ajax request: by $.post javascript code: data='{"jsonrpc": "2.0", "method": "secret", "params": {"a": "as12"}, "id": 1}' $.post( 'RPC2', data, function(data1) { alert("Response: " + data1); } );
the python receive code: @csrf_exempt @jsonrpc_method('app.addStrings(arg1=String) -> String', validate=True) def add(request, secret_data):
but I get the 403 Forbiden as CSRF problem. I think I have already writen @csrf_exempt, but it don't work.