我有下面的代码:如何增加JavaScript中变量的范围?
$('.task-list').each(function(list, response) {
response = $('#' + this.id).sortable('toArray');
});
console.log(response);
我得到的错误是反应是不确定的。我尝试调整第2行为var response
,但得到了相同的错误。
我试图通过循环页面上的项目,然后提交一个单一的Ajax响应更新它的服务器来构建一个数据数组。
什么'.sortable( '指定者')'做什么? –
你能澄清你想要的结果吗?有多少个.task-list元素? – jmar777
'$(this)'而不是'$('#'+ this.id)'请...... –