47π
It is likely that the json is not properly formed. Sometimes this happens to me when my code, that should be producing json is generating an error. Two options:
-
Use firebug to view the JSON response
-
Setup error handling in your jquery code using the jQuery.ajaxSetup options such as:
$.ajaxSetup({"error":function(XMLHttpRequest,textStatus, errorThrown) { alert(textStatus); alert(errorThrown); alert(XMLHttpRequest.responseText); }});
Using the error handling for debugging is great, since you will know immediately when there is a problem with your response. You can check out the jQuery documentation for jQuery.ajax which has all of the available options for jQuery.ajaxSetup.
EDIT: A third option would be to just open the URL that should be generating the JSON and run the output through JSON Lint to validate it.
3π
Are you sure the JSON is valid? take a look at the response directly or use Firebug
- [Django]-Multi-tenant SAAS in Django
- [Django]-Reverse engineer mysql database to create django app
- [Django]-Detect django testing mode
1π
I ran into this a while back and rewrote a wrapper for jQueryβs Ajax which allows you to pass the normal getJSON and an additional error callback per get.
http://www.nurelm.com/themanual/2010/08/09/self-indulgent-code-jquery-getjson-with-error-handling/
- [Django]-How do I install psycopg2 for Python 3.x?
- [Django]-Is there a way to loop over two lists simultaneously in django?
- [Django]-Django 1.7 β "No migrations to apply" when run migrate after makemigrations
- [Django]-What is the purpose of adding to INSTALLED_APPS in Django?
- [Django]-Custom form validation
- [Django]-Django static files versioning