Thanks! kurtis, it did helps me. but, to render the form once it return
validation error. i need to use javascript returned value and
manipulate the form.
is there any refresh form content instead of i need to base on returned
value and manual add the error message?

On Thu, May 3, 2012 at 1:16 PM, Kurtis Mullins <kurtis.mull...@gmail.com>wrote:

> Here's something I do.
>
> I have a page where I include {% csrf_token %} and another field. Then I
> do a simple JQuery .post() call.
>
> Note, I've tried to pull out a bunch of stuff that isn't specific to the
> call. It's untested in this form but should work. I tried to include
> comments to help you understand what's going on.
>
> <script type="text/javascript">
> $('div.theme_image, div.theme_name').on("click", function(event) {
>
>     // Used later to access 'this' (the calling object)
>     var theme = this;
>
>     // Prepare our AJAX Call.
>     url = '{% url fireflie.wizard.api.choose_theme %}'; // The URL to the
> View we're posting to.
>
>     // Building the POST data here.
>     data = {
>         theme_id: $(this).siblings('input').attr('value'),
>         csrfmiddlewaretoken:
> $('input[name=csrfmiddlewaretoken]').attr('value')
>     };
>
>     // Post Data to the Server
>     var jqxhr = $.post(url, data, function(data) {
>
>         // Do something in here on Success
>         // In my example, I wanted to manipulate the calling object,
>         // so it would be "theme" here. If you try to use "this", it won't
> work.
>
>     });
>
>     // On Error:
>     jqxhr.error(function() {
>
>       // Do something in here in the case of errors.
>
>     });
>
> });
> </script>
>
> Good luck!
> -Kurtis Mullins
>
> On Thu, May 3, 2012 at 1:46 PM, Bill Freeman <ke1g...@gmail.com> wrote:
>
>> AJAX
>>
>> You may require a separate view, but maybe not.
>>
>> If you search for jQuery and AJAX there should be samples.
>>
>> On 5/3/12, Min Hong Tan <tan.dja...@gmail.com> wrote:
>> > is there any sample that i can refer to do the ajax style form post
>> > without refresh the whole page?
>> > or backend form.save validation without refresh my form?
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> Groups
>> > "Django users" group.
>> > To post to this group, send email to django-users@googlegroups.com.
>> > To unsubscribe from this group, send email to
>> > django-users+unsubscr...@googlegroups.com.
>> > For more options, visit this group at
>> > http://groups.google.com/group/django-users?hl=en.
>> >
>> >
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to