Hi,

I'm trying to make the most of Mezzanine's ajax handling capabilities for 
blog comments. For example I'm using the js

$(function() {
    $('form#blog-comment').submit(function(event) {

            $.post(form.attr('action'), form.serialize(), function(data) {
                //ajax success
                if (data.location) {
                    location = data.location;
                }else if(data.errors){
                    console.log('There were some form errors');
               }, 'json');

              return false;
    });
});

This handles the case of the user submitting an invalid form by ajax 
perfectly, but if a user actually submits a valid comment form, nothing 
happens. I can see in Firebug the 302 redirect to the new comment 
"http://mysite.org/blog/another-random-post/#comment-16 ", but the redirect 
doesn't actually happen anymore (maybe because the ajax is still waiting 
for the JSON response?). 

I examined the mezzanine/generic/views.py comment function, and as far as I 
can tell it doesn't deal with the case when the form is valid and it was 
submitted by AJAX? I mean it doesn't give a JSON response with 
data.location like it should? If form.is_valid() the view gives a regular 
response regardless of if request.is_ajax()?

What is going on here?

-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to