f***c 发帖数: 338 | 1 【 以下文字转载自 BuildingWeb 讨论区 】
发信人: franc (笨◎), 信区: BuildingWeb
标 题: 问个jquery处理字符串的问题
发信站: BBS 未名空间站 (Tue Jun 3 00:19:33 2014, 美东)
问题很简单,不知道在这里问是否合适。Django
后台服务器发送数据
data=[['1',1],['2',2],['3',3]]
如果用html的直接显示,没有问题。
{% for row in data %}
{{ row }}
{% endfor %}
但是我需要用Flot做图,jquery接收后,
data变成
data = [['1',1],['2',2],['3 ',3]]
即‘被escape成 '。
如何使jquery看到的data也是['1',1]而不是['1',1].
谢谢! | k****0 发帖数: 7 | 2 jsonify your list data before passing it the template. Also consider using a
REST framework if you need to frequently deal with these structured data. | f***c 发帖数: 338 | 3 thank you very much. I tried googling this issue for couple days. This is
the best suggestion I got (I'm a green hand in web-dev. everything is so new
to me, :P). Thanks and have a nice day. |
|