Re: java script alert from view after sucessfull opreation
You can feed variables back through HttpResponse() using json serializer. eg. from django.utils import simplejson response = {'Name': Name, 'Email': activeUser.email} json = simplejson.dumps(response) return HttpResponse(json, mimetype="text/json") You should really look into AJAX as suggested earlier. JD On Monday, September 17, 2012 1:29:46 AM UTC-6, JirkaV wrote: > > > how to use java script alert from view after sucessfull opreation in > view > > Simplest way is to set some context variable (a.k.a. "flag") in the > view (e.g. "operation_successful = True") and have a piece of JS code > in your template that runs only when this flag is set, e.g: > > {% if operation_successful %} > > alert("operation was successful") > > {% endif %} > > There is a lot more ways to do this, at some later point you will > probably want to read about AJAX calls. > > HTH > > Jirka > -- 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/-/-mPy0os1zokJ. 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.
Re: java script alert from view after sucessfull opreation
> > but i used function HttpResponse() not render_to _response(). So how > to carry variable from view to template with httpresponse() -- 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/-/9XPFi-TMy4AJ. 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.
Re: java script alert from view after sucessfull opreation
> how to use java script alert from view after sucessfull opreation in view Simplest way is to set some context variable (a.k.a. "flag") in the view (e.g. "operation_successful = True") and have a piece of JS code in your template that runs only when this flag is set, e.g: {% if operation_successful %} alert("operation was successful") {% endif %} There is a lot more ways to do this, at some later point you will probably want to read about AJAX calls. HTH Jirka -- 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.
java script alert from view after sucessfull opreation
how to use java script alert from view after sucessfull opreation in view ifself? -- 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/-/v41IbNfmmgYJ. 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.