Re: how to use java script alert in view? i use form submit on post method. After sucessfull opreation in view i want alert

41 views
Skip to first unread message

Kev Dwyer

unread,
Sep 17, 2012, 12:57:21 AM9/17/12
to django...@googlegroups.com
Navnath Gadakh wrote:

>
>
Hello Navnath,

You can either submit the form via javascript and display the alert based on
the response from the view, or submit the form normally and in your
javascript code poll another view to check the result.

The first method is better, in my view. Both methods depend on the user
having enabled javascript in their browser. Depending on your use case,
this may not be a safe assumption.

Cheers,

Kev

Jani Tiainen

unread,
Sep 17, 2012, 1:30:18 AM9/17/12
to django...@googlegroups.com
17.9.2012 7:31, Navnath Gadakh kirjoitti:
>
> --
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/t6s6YgYVAY8J.
> To post to this group, send email to django...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.


First, a small nitpicking: you shouldn't post question to subject line
only.

It all depends what you really mean by "alert"? Standard javascript
alert popup? That can be quite easily done by redirecting a view that
has template that contains javascript alert that is triggered for
example onload event.

Though in general all kind of interruptive messaging is bad and will
cause a pain after a while.

Also what would you show in case of unsuccessful operation? An alert as
well?

--
Jani Tiainen

- Well planned is half done and a half done has been sufficient before...

Navnath Gadakh

unread,
Sep 17, 2012, 2:24:49 AM9/17/12
to django...@googlegroups.com
on sucess and unsucess i want java script alert.
Reply all
Reply to author
Forward
0 new messages