【发布时间】:2012-03-27 09:34:07
【问题描述】:
我有一个场景,客户端上处理的数据以不同于服务器上的方式呈现和交互。
考虑以下从服务器返回的event 资源。
{
"id": 123,
"start_at": 1331336004906,
"end_at": 1331337704906
}
以及以下模板进行编辑:
<form>
<!-- Notice how date and time are separated in the interface -->
<input type="text" name="start_date" value="{{start_date}}" />
<input type="text" name="start_time" value="{{start_time}}" />
<!-- Instead of asking for an end date/time, we ask for the duration -->
<input type="text" name="duration" value="{{duration}}" />
<input type="submit" />
</form>
如何在不将start_date、start_time 和duration 视为我的主干模型中的属性而不将它们发送到服务器?我应该修改.toJSON()吗?
【问题讨论】:
-
事件资源格式有什么问题,不是时间戳吗?
标签: javascript backbone.js javascript-framework