开发者

communication between page

开发者 https://www.devze.com 2023-03-08 19:00 出处:网络
I hav开发者_C百科e a page (Page A) where user can send email to others, then user should can choose the recipients.

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!

0

精彩评论

暂无评论...
验证码 换一张
取 消