We present a calculation of the variation of the binding energy of a heavy-hole exciton in a highly ionic quantum well structure, as a function of well width using a variational approach. We include the effects of exciton-phonon interaction and of mismatches between the particle masses and the dielectric constants of the well and barrier layers. The effect of exciton-phonon interaction is described in terms of an effective potential between the electron and the hole, derived by Pollmann and Büttner ͓J. Pollmann and H. Büttner, Phys. Rev. B 16, 4480 ͑1977͔͒ using an exciton-bulk optical-phonon Hamiltonian. We find that the values of the exciton binding energies we calculate agree very well with those obtained using a more rigorous but a complicated approach due to Zheng and Matsuura ͓R. Zheng and M. Matsuura, Phys. Rev. B 58, 10 769 ͑1998͔͒ in which they consider an exciton interacting with the confined-longitudinal optical phonons, interface phonons, and half-space phonons. Our method has the advantage of being considerably simpler, more efficient to use and is much easier to generalize to include the effects of external perturbations such as electric and magnetic fields. We compare the results of our calculations with the available experimental data in a few ionic quantum well structures and find a very good agreement. We show that for an appropriate understanding of the experimental data in ionic quantum well structures one must properly account for the exciton-phonon interaction.