Rendering JSON objects using a Django template after an Ajax call

前端 未结 8 1799
南笙
南笙 2020-12-02 03:59

I\'ve been trying to understand what\'s the optimal way to do Ajax in Django. By reading stuff here and there I gathered that the common process is:

  1. formul

8条回答
  •  隐瞒了意图╮
    2020-12-02 04:20

    Templates are for the purpose of presentation. Responding with data in format X (JSON, JSONP, XML, YAML, *ml, etc.) is not presentation, so you don't need templates. Just serialize your data into format X and return it in an HttpResponse.

提交回复
热议问题