A typical workflow is for the server to return the JSON object as text and then interpret the object in javascript . In your case, you can return the text {"httpresponse": 1} from the server or use python json libary to create this for you.
JQuery has a nice json-reader (I just read the docs, so there might be errors in my examples)
JavaScript:
$.getJSON("/abc/?x="+3, function(data){ if (data["HTTPRESPONSE"] == 1) { alert("success") } });
Django
An alternative view suggested by Issy (cute, because he follows the DRY principle)
def updates_after_t(request, id): response = HttpResponse() response['Content-Type'] = "text/javascript" response.write(serializers.serialize("json", TSearch.objects.filter(pk__gt=id))) return response
source share