$('.btn-group').find('#mark_as_done').on('click', function() { var tasks = grab_selected(); $.ajax({ type: 'POST', url: '/edit_lists/', data: {'tasks[]': tasks}, }); });