I’m new with django and jquery, and I try to implement a very simple $post request.
Here is what I did:
my js:
$.post(/mysite/blabla/, {
score : 40
});
my views:
def blabla(request):
score_user = 20
if request.method == 'POST':
score_user = request.POST['score']
The console does not indicate any error for the post request. The thing is that when I render “score_user”, I always get 20, when I expect to get 40.
Any help would be welcome. Thanks
EDIT:
my model:
class UserProfile(FacebookProfileModel):
user = models.OneToOneField(User)
comment = models.BooleanField()
score = models.IntegerField(null=True, default=0)
1 Answer