Reputation: 171
I have this error and I don't know the reason :
This error is in my console :
[05/Jul/2015 15:42:35] "POST /suppression-demande HTTP/1.1" 200 4262
Traceback (most recent call last):
File "/usr/lib/python2.7/wsgiref/handlers.py", line 86, in run
self.finish_response()
File "/usr/lib/python2.7/wsgiref/handlers.py", line 128, in finish_response
self.write(data)
File "/usr/lib/python2.7/wsgiref/handlers.py", line 212, in write
self.send_headers()
File "/usr/lib/python2.7/wsgiref/handlers.py", line 270, in send_headers
self.send_preamble()
File "/usr/lib/python2.7/wsgiref/handlers.py", line 194, in send_preamble
'Date: %s\r\n' % format_date_time(time.time())
File "/usr/lib/python2.7/socket.py", line 324, in write
self.flush()
File "/usr/lib/python2.7/socket.py", line 303, in flush
self._sock.sendall(view[write_offset:write_offset+buffer_size])
error: [Errno 32] Broken pipe
[05/Jul/2015 15:42:35] "POST /suppression-demande HTTP/1.1" 500 59
On click on a button, this JS methods is called :
function goto_confirm(username){
adress = "/suppression-demande"
if(confirm("Are you sure ?")){
$.ajax({
type:"POST",
url:adress,
data: {
'confirmation_suppression': true,
},
success: function(data){
alert("data : "+data);
}
});
window.location.href = "/home";
}
return false;
}
The URL : url(r'^suppression-demande$', 'supprimer_demande', name="supprimer_demande"),
My View called by js method :
def supprimer_demande(request):
confirmation = request.POST.get("confirmation_suppression")
return render(request,"website/lsdme.html")
Upvotes: 0
Views: 1189
Reputation: 1285
Try removing
window.location.href = "/home";
from your js method go_confirm().
Upvotes: 3