The typical workflow is to have the server return a JSON object as text, and then interpret that object in the javascript. In your case you could return the text {"httpresponse":1} from the server, or use the python json libary to generate that for you.
JQuery has a nice json-reader (I just read the docs, so there might be mistakes in my examples)
Javascript:
$.getJSON("/abc/?x="+3,
function(data){
if (data["HTTPRESPONSE"] == 1)
{
alert("success")
}
});
Django
#you might need to easy_install this
import json
def your_view(request):
# You can dump a lot of structured data into a json object, such as
# lists and touples
json_data = json.dumps({"HTTPRESPONSE":1})
# json data is just a JSON string now.
return HttpResponse(json_data, mimetype="application/json")
An alternative View suggested by Issy (cute because it 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