1.创建model尽量提前确定字段类型,后续网页输入错误自带,错误提示而不是代码error。免去了捕获的编写
2. id 复选框,多选
<th><input type="checkbox" name="check_box"></th>
<td align="center"><input type="checkbox" name="check_box_list"></td>
3.button 修改 状态信息 html
<td> {% if row.status == 4 %} <div> <button type="button" class="btn btn-info btn-xs rep-row" nid="{{ row.id }}" >xxxxx</button> </div> {% else %} <div> <button type="button" class="btn btn-info btn-xs rep-row " nid="{{ row.id }}" disabled="disabled"> xxxxx </button> </div> {% endif %} </td>
bindReport();
function bindReport() { $('#tb').on('click', '.rep-row', function () { var rowId = $(this).attr('nid'); $.ajax({ url: '/xxxxx.html', type: 'GET', data: {'nid': rowId}, success: function (arg) { var dict = JSON.parse(arg); if (dict.status) { window.location.reload(); } } }) }); }