Now, I've never used Ajax, so this is just a short in the dark
at the broad side of a barn.

With that in mind, I was wondering if the "/mysite/myajax" part
shouldn't have an extension on the "myajax" part, as in "myajax.html"
or something?

If not why not?  Isn't that referring to a specific page on your site?

Rick

> -----Original Message-----
> From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of gms
> Sent: Friday, January 18, 2008 6:13 PM
> To: jQuery (English)
> Subject: [jQuery] Using getJSON...not successful
> 
> 
> Hello,
> I am new to JQuery.  I'm trying to get a JSON response back from my
> django view.  However, I guess my data never gets loaded
> successfully.  Does anybody know what I'm doing wrong?
> 
> <script>
> $(document).ready(function(){
>   $("#first").click(function(){
>     $.getJSON("/mysite/myajax", function(data) {
>       alert("Here");
>     });
>   });
> });
> </script>
> 
> ////
> def myajax(request):
>     a = Testimonial.objects.all()[:3]
>     response_dict = {}
>     response_dict.update({'a': a})
>     return HttpResponse(simplejson.dumps(response_dict),
> mimetype='application/javascript')
> 
> ///////////
> 
> Whenever I access this page and click on my div that contains the id
> 'first'...nothing happens.  I should see an alert that says 'Here'.
> 
> Any Suggestions on what I'm doing wrong?
> 
> Thanks


Reply via email to