Sounds like you want AJAX with a modal window.
You don’t need to change your code at all; just how you send and receive it from your server. Is your page using jQuery? There are several modal plugins for jQuery that support ajax. [Colorbox](http://www.jacklmoore.com/colorbox) is one of my favorites, but look around.