ループでjs関数を生成したいのですが、問題があります。私の考えが正しいと言える人はいますか?ループで関数を生成することは可能ですか?
var sortItems =
["sortable11","sortable12","sortable13","sortable14","sortable15",
"sortable21","sortable22","sortable23","sortable24","sortable25",
"sortable31","sortable32","sortable33","sortable34","sortable35",
"sortable41","sortable42","sortable43","sortable44","sortable45",
"sortable51","sortable52","sortable53","sortable54","sortable55"];
for ( key in sortItems) {
$(function(){
$('#' + sortItems[key]).sortable({
update: function(event, ui)
{
$.ajax({
type: "POST",
url: "fun/saveOrder.php",
dataType: "text",
data:
{
key:$(this).sortable('toArray')
},
cache: false,
beforeSend: function(){$('#updateResult').html('updating');},
success: function(data){$('#updateResult').html(data);},
error: function(data){$('#updateResult').html(data);}
})
recalculate();
}
})
})
}