0👍
✅
This view needs to be reached from a normal submit and from an ajax one
1) Add a parameter to the called url for let understand the view if is an ajax call or not, you can also use an hidden field set ad “ajax”
2) If the view found the parameter “ajax” it give you back a message or an error if there is one, otherwise it perform the redirect.
Consider also to use two different urls for the same view
book/create/(?P<type>[a-z])/
book/create/standard/$ """do redirect after submit"""
book/create/ajax/$ """return httpresponse"""
2👍
Add a success
parameter to the plugin call:
$('#your_form').ajaxForm({
success: function(response){
alert("Data added successfully");
}
});
Hope this helps. Cheers
- [Answered ]-Set name attribute in Django generated select field
- [Answered ]-Django how to override 'get_or_create' to create parent object if it doesn't exist
- [Answered ]-Django templates override: where is "Change YOUR_MODEL"
Source:stackexchange.com