I hav开发者_C百科e a page (Page A
) where user can send email to others, then user should can choose the recipients.
So when user click the "Choose contact" button in Page A
, a new browser page (Page B
) will open where all their contacts in the database will be displayed using the check box list.
Then the user can choose the contacts he want, when he click "OK" button in Page B
,the Page A
will close. Then how should I get, in Page A
, the contacts the user chosen over at Page B
?
There are several ways to do this. I believe the simplest is a pure JavaScript solution.
Create a JS function on the parent page that will handle the contacts that are received. When the submit/finish button is clicked on the child page, pass the selected contacts to the parent by using
window.opener.SomeFunctionName(arrayOfContactsOrContactIDs);
If you indeed open a new window, you can use the window.opener
to talk with the parent window.
I would suggest, though, that you use an ajax call to fetch the contacts and display them in the current page (perhaps in an overlay).
You can use AJAX ToolKit Modal Popup.
You can save contact in a session variable for example!
精彩评论