Thanks, I'll definitely check that out. The last time I did AJAX stuff was a couple of years ago when it was the hot spanking-new thing (even though it isn't new), so there weren't really any good libraries out yet. Thanks for pointing me to the serialization doc.
My other thought is to create a custom tag that automatically builds the from with a hidden data in it, but I haven't looked into custom tags to see if that's possible yet. Thanks! On Apr 11, 10:11 am, "Norman Harman" <[EMAIL PROTECTED]> wrote: > Taylor wrote: > > Thanks for the replies, but I guess I didn't make myself clear > > enough. Counter was just as an example, I don't want an actual page > > counter. > > > I guess part of my question is: Yes, I can use AJAX-y XMLHttpRequest > > to send info to the server in the background, but has someone done > > this already in django somewhere and posted code that can be plugged > > in? > > > The idea is to have a view like this: > > def my_view(request,num=0): > > counter = Counter.objects.get(id=someid) > > counter.count += num > > counter.save() > > # setup view stuff > > > but without specifying num in the URL or having to use a <form> in my > > template. > > > Thanks > > If num isn't in the URL and it isn't a GET/POST parameter, where is it > coming from? > > For front end of AJAX, use whatever Javascript lib/code you like, Jquery > is my choice. Django doesn't come with or dictate a particular one. The > back end, Django part, of AJAX works exactly like any other view but > return JSON or XML data instead of HTML. > > def my_view(request) > data = simplejson.dumps(Model.objects.filter(somefilter=whatever)) > return HttpResponse(data, mimetype="text/javascript") > > orhttp://www.djangoproject.com/documentation/serialization/ > > -- > Norman J. Harman Jr. 512 912-5939 > Technology Solutions Group, Austin American-Statesman > > ___________________________________________________________________________ > Get out and about this spring with the Statesman! In print and online, > the Statesman has the area's Best Bets and recreation events. > Pick up your copy today or go to statesman.com 24/7. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---

