established sort functionality with ajax.