The selector should not be #input
. That means a field with id="input"
which is not your case. You want:
$('#chag_sort').val(sort2);
Or if your hidden input didn't have an unique id but only a name="chag_sort"
:
$('input[name="chag_sort"]').val(sort2);