Link to home
Start Free TrialLog in
Avatar of pmac38CDS
pmac38CDS

asked on

Passing values back from an aspx page(popup window) to an html page

I have an html page with a button called Donate. When the user clicks on that button an aspx page opens up in a pop up window. The aspx page contains data which is filled in by the end user. When the user clicks on the Submit Payment button the backend code calls PayPal's PayFlow Pro API to processes that information. If the transaction is successful it returns an Authentication Code. I would like to pass this Authenticate Code back to the HTML page.

Is there anyway I can achieve this ?
Thanks,
Aditya
Avatar of Imran Javed Zia
Imran Javed Zia
Flag of Pakistan image

This is simple task and can be done with javascript by calling parent window javascript methods/fields from popup with
window.opener.PranentMethod ...
window.opener.fileds...

please follow these links:
http://chiragrdarji.wordpress.com/2007/03/10/call-parent-windows-javascript-function-from-child-window-or-passing-data-from-child-window-to-parent-window-in-javascript/
http://stackoverflow.com/questions/4350223/passing-data-between-a-parent-window-and-a-child-popup-window-with-jquery

Thanks

Avatar of pmac38CDS
pmac38CDS

ASKER

Those solutions won't work in my case since I need to process some information before closing the pop up. Also I need to pass the authentication code back to the parent form.
ASKER CERTIFIED SOLUTION
Avatar of pmac38CDS
pmac38CDS

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Nevermind I was able to solve this issue.I use the following to implement the functionality
Page.RegisterStartupScript("myScript", "<script language=JavaScript>signalPostback('" + this.authCode + "','" + this.transactionResponse + "');</script>");

 function signalPostback(authCode, transactionResponse) {
        window.opener.document.getElementById('TXT_AuthCode').value = authCode;
        window.opener.document.getElementById('TXT_Response').value = transactionResponse;
        window.close();
    }