【发布时间】:2010-09-16 22:32:03
【问题描述】:
我有下一个脚本,“/cashflow/arrow/”调用一个 django 视图来获取数据并使用它。然后返回html中加载的数据。
该脚本在第一次单击时运行良好,但是当我想再次单击链接时,没有任何反应。
<script>
$(document).ready(function(){
var prev_months = {{ prev_months }}
var next_months = {{ meses_desp }}
function arrow(meses_ant, next_months) {
$.get("/cashflow/arrow/", { prev_months: prev_months, next_months: next_months},
function(data){
$("#cash_grid").html(data);
});
}
$("#dates_up").click( function() {
if (prev_months > 0) {
prev_months = prev_months - 1;
}
next_months = next_months + 1;
arrow(prev_months, next_months);
});
$("#dates_down").click( function() {
prev_months = prev_months + 1;
if (next_months > 0) {
next_months = next_months - 1;
}
arrow(prev_months, next_months);
});
})
【问题讨论】: