Friday, September 10, 2010

Re: Change variable value after a click

It's definitely a good idea to gain some AJAX experience first, but on
how to integrate it with Django:
You'll have to write a special view to retrieve the additional elements
to be displayed on the page.
That's "how to do it" in general, hope it'll help you a bit

Regards,
Felix


On 10.09.2010 22:02, nick.lang@gmail.com wrote:
> I don't think you can do this with a view and NOT refresh the page.
>
> To get the functionality you want you need to use AJAX (and jquery would
> make it easier).
>
> do some research on how to use jquery to manipulate the dom and add HTML
> elments to the page live.
> There some jquery bits out there that'll allow you to manipulate the
> document (read: page your on) through various click based events.
>
> Start with a page that has a button on it (or a link) and put a
> "<script>you're code goes here</script>" in there that gets called on
> the "onClick" event that will then put a <p>Hello World</p> on the page.
> That'll get you the basic functionality that you need (sorry I'm low on
> resources for you, but there's plenty of stuff out there if you google it!)
>
> n
>
> On Fri, Sep 10, 2010 at 11:39 AM, mf <mf2286@gmail.com
> <mailto:mf2286@gmail.com>> wrote:
>
> I'm working in a django view and I'd like to duplicate the
> items_rating value of myview when I click to "see more categories" in
> the template. All of this without refreshing the web.
>
> I think that I have to use jquery and Ajax to perform this action but
> I don't know how to do it. The examples I read about were about form
> submissions and I couldn't find a way to use it.
>
> views.py:
>
> def myview(request):
> items_rating = 5
> html:
>
> <a href="#">See more categories</a>
>
> --
> 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
> <mailto:django-users@googlegroups.com>.
> To unsubscribe from this group, send email to
> django-users+unsubscribe@googlegroups.com
> <mailto:django-users%2Bunsubscribe@googlegroups.com>.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>
>
>
> --
> Guadajuko! Vamos a correr!
> -"Cool! we are going to run!"
>
> --
> 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+unsubscribe@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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment