My code makes a call to a service called OneID. The code is javascript and it prompts you to authorize the sharing of your email address (stored in the OneID repository) with a site.

I need the email address to be returned to the parent page if the user clicks, "OK".
Right now, all I can get it to do is generate a javascript Alert.
Note If you decide to help with this, you'll need to create a OneID account, sorry.
    <script src="https://api.oneid.com/form/form.js" type="text/javascript"></script>';
    echo '<script type="text/javascript">
    OneIdExtern.registerApiReadyFunction(
        function(){
            OneId.getUserAttributes(
                {
                    attr: "email[email]", 
                    authLevel : null, 
                    selectCards : true,
                    forceSelectCards : true
                },
                function(data){ 
                    if (data.attribute_data.email.email) {
                        <<-- somehow send data back to page? -->>
                    }
                }   
            );
        }
    );
    </script>';
 
     
    