Ah - thank you! Yes, sorry, in the process of my debugging the issue and trying to simplify it, I unintentionally introduced even more errors, and then when posting it, even more! But you somehow despite that, managed to identify my real error, which was that I hadn't put the single quotes around {% get_my_url %}.
I was clearly doing a spiral downward - thanks very much for your save! Margie On Aug 20, 2:40 pm, Matthias Kestenholz <matthias.kestenh...@gmail.com> wrote: > On Thu, Aug 20, 2009 at 11:34 PM, Margie > > > > Roginski<margierogin...@yahoo.com> wrote: > > > Could someone give me a hand with a very simple ajax problem? I want > > to post some data and have the server just return a small snippet of > > html, which I then want to insert into my dom at a particular id. > > > Let's say the html snippet to be returned is just a string: <p>hello > > world</p>. > > > Does my views.py function just return it like this? > > > return HttpResponse("<p>hello world</p>") > > > I have some jquery on client side that is just trying trying to have > > the callback function throw the returned snippet up in an alert box, > > like this: > > > <input type="submit" onclick="$(.post({% get_my_url %}, $ > > ('id_comment').val(), function(data) { alert(data);}); return false; > > " /> > > > I find that I never hit my callback function (the alert(data)). > > Instead the browser just replaces my with a page containing > > > <html><head><body>hello</body></html> > > > Could someone give me a pointer as to what I'm doing wrong? > > I'd say you get a javascript error in your onclick handler, this does > not look like a server error at all. You should probably add quotes > around the {% get_my_url %} stuff; or does this template tag add the > quotes itself? > > After reading the snippet for a second time, I've got to say it looks > quite messed up. This won't work. Try something like that: > > <input type="submit" onclick="$.post('{% get_my_url %}', > $('#id_comment').val(), function(data) { alert(data);}); return > false;" /> > > (Parentheses in $.post removed, # added in $('#id_comment'), added > quotes around {% get_my_url %} ) > > Matthias > > -- > FeinCMS Django CMS building toolkit:http://spinlock.ch/pub/feincms/ --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---