The problem with using the shortcut methods for new people is that it does
not give you any error feedback.  I would suggest that you use the $.ajax
method till you get used to the process, it will allow you to set for
errors.

But in the mean time, put the below before you getJSON method:

 $("#msg").ajaxError(function(event, request, settings){
   $(this).append("<li>Error requesting page " + settings.url + "</li>");
 });


just create a div with the id of msg.  This "should" print out what the
error is.  If not, then go with the $.ajax method.

            $.ajax({
                url: URL,
                dataType : 'json',
                data : {},
                success : function(data, textStatus){

                },
                error : function(x, txt, e){
alert(txt);
                }
            });

On 1/18/08, J Moore <[EMAIL PROTECTED]> wrote:
>
>
>
> to isolate the problem, make your script dump out something like:
> {"a": "hello"}
>
> are you sure it's not a 404? is jquery being found? It could be lots
> of things...
>
> if you haven't already, install firebug (and use firefox). It will
> save you a lot of frustration.
>
> On Jan 18, 6:13 pm, gms <[EMAIL PROTECTED]> wrote:
> > 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
>



-- 
Benjamin Sterling
http://www.KenzoMedia.com
http://www.KenzoHosting.com
http://www.benjaminsterling.com

Reply via email to