The near-edge x-ray-absorption fine structure at the Na K-edge is compared for a solution of 1 M NaI in water vs ethanol. We find a strong influence of the solvent on the unoccupied electronic states locally at the Na+ ions. The experimental data are compared to theoretical spectra based on electronic structure calculations using the density functional theory approach. The calculated spectra agree well with the experimental measurements. The comparison suggests that cation-anion interaction is important in water while it can be neglected for ethanol as a solvent. The behavior upon solvent change is rationalized by inspection of the molecular orbitals giving rise to the different spectral features.