Event callback from shared resource

Event callback from shared resource

I have an html page that has a link on it. When that link is clicked I open a dialog and use ajax to load some content into that dialog. The content is a search form used to find people in a database. That content comes from a different website on my server.
My issue is that once the user has search and found a person they want to select I need to get the information about that selection back to the original calling form. How can i do that?
So the workflow is webpage1>click link>dialog opens with content from webpage2>user selects something in webpage2>need an event to notify webpage1 about what happened.

I can think of one crummy way to get this done: I could have a hidden div in my page1 and then in page2 i assume that div is there and i write content to it when a user selects a person. I then have an on change event in page1 on that hidden div so i know when it is modified.

I hate that approach.

The approach i would like (and have no idea if it will work) would be for the content in page2 to be a part of a larger object that is a plugin with events being broadcast when a person is selected. That way page1 could be any client of page2 (the plugin). page3 and page 9 could use the plugin as well.

Is this even possible?

Another crappy way would be if i passed the name of a function that is in page1 over to page2 via querystring when i open page2. then have page2 fire that event, again, assuming it was present in page1.

Any suggestions?