var $data = {}; $start.on('click', function(){ $data = $.ajax({ type: 'POST', url: '/ajax/getData/', dataType: 'json', data: {'numL': $numL} }); });