Physical studies of asteroids: XVII. JHK photometry of selected main-belt and near-Earth asteroids