我知道如何使用 JQuery ajax 功能调用 Django 的“url View ”。
import simplejson as json
def the_view(request):
fruits = {'color':5, 'type': 22}
jfruit = json.dump(fruits)
return render_to_response( THE JSON OBJECT!!! ...how? )
请您参考如下方法:
返回 HttpResponse(simplejson.dumps(mydictionary), mimetype="application/json")
参见 b-list
