tags:

views:

25

answers:

2

Hi,

I created a custom "like" button. The "like" is inside a post form html element. For my view.py after i process the form post, i only want to return http response success and not load any type of success page. What kind of object would i return in this case?

Thanks, David

+1  A: 

You can just return a HTTP response without any content:

from django.http import HttpResponse
return HttpResponse()
WoLpH
+2  A: 

You'll need to use Javascript to fire an ajax POST request, rather than a standard browser request because the behaviour you're trying to avoid is exactly what a standard request / response cycle does: browser triggers request and displays response as the next page.

Alternatively, you could probably use some kind of iframe, but that'd be just ugly.

SmileyChris
Dont mention iframes. They are a devil, best left unnamed, else someone will dig out that knowledge and use it.
Zayatzz