I’ve got the following code:
$('.task-list').each(function(list, response) {
response = $('#' + this.id).sortable('toArray');
});
console.log(response);
The error I’m getting is response is undefined. I tried adjusting line 2 to be var response but got the same error.
I’m trying to build an array of data by looping over the items on the page and then submitting a single ajax response to the server to update it.
You probably want $.map instead: