summaryrefslogtreecommitdiff
path: root/src/meetingtools/multiresponse.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/meetingtools/multiresponse.py')
-rw-r--r--src/meetingtools/multiresponse.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/meetingtools/multiresponse.py b/src/meetingtools/multiresponse.py
index 5c58774..077f446 100644
--- a/src/meetingtools/multiresponse.py
+++ b/src/meetingtools/multiresponse.py
@@ -34,8 +34,15 @@ def make_response_dict(request,d={}):
return d
-def json_response(data):
- r = HttpResponse(simplejson.dumps(data),content_type='application/json')
+def json_response(data,request=None):
+ response_data = None
+ if request and request.GET.has_key('callback'):
+ callback = request.GET['callback']
+ json = simplejson.dumps(data)
+ response_data = "%s(%s)" % (callback, json)
+ else:
+ response_data = simplejson.dumps(data)
+ r = HttpResponse(response_data,content_type='application/json')
r['Cache-Control'] = 'no-cache, must-revalidate'
r['Pragma'] = 'no-cache'