Hope you have solved this problem already. I ran into a similar
problem today while trying to use something like
task = request.POST.get('task')
which I thought should work since it worked for GET. I have a large
list to pass back and GET did not have enough room.
I ended up doing something like this:
def addtask(request):
post = request.POST.copy()
task = post['task']
a = "taskname" + str(tsk)
r.write(a)
return r
notice that I used post=request.POST.copy()
This helped my solution considerably.
> In thisrequest.POST.get() is not Working..It Gives empty value
>
> My Views is:
>
> def addtask(request):
> r=HttpResponse()
> ifrequest.method == 'POST':
> task=request.POST.get('task')
> a = "taskname"+ str(task)
> r.write(a)
> return r
>
> My Template is :
>
> function addtasks()
>
> {
>
> vartask=document.getElementById("task").value;
> $.ajax({
>
> url: "/simple2dos/addtask/",
>
> type: "POST",
>
> data: "val=1&task="+task,
>
> success: function(feedback){
> alert(feedback);
> }
> }):}
>
> <input type="text" id="task" name="task" value="">
> <input type="button" name="submit1" value="Submit"
> onclick="addtasks();">
>
> If i use GET instead ofPOSTmeans its working Fine..