Send email after onclick button

Hello I’m creating a hiring website and for employers to see someone’s cv , they need to ask for permission.
When an employer asks sor someon’s cv they see this in their page

Then from my admin page I can give them the permission to see it


and it appears in their member page like this :

WHAT I WANT :
I want 2 things :
-when someone asks to see a cv, the admin recieves an email.
-when the admin accepts a request, the user gets and email to tell them “your request was accepted”
I tried to do it with sendgrid the same way people do for forms, but I don’t know how to get data from the dataset/repeater, and I don’t know where to put the sendemail function in my code.
my code :

$w.onReady(function () {
   $w("#dataset1").onReady( () => { 
   $w("#repeater1").forEachItem( ($item, itemData, index) => { $item("#button1").onClick((event) => { 
   $w("#dataset1").refresh() 
   $w("#dataset2").refresh() 
   console.log("you clicked " + itemData._id) $w("#dataset1").getItems(index, 1) 
   .then( (result) => { 
   let items = result.items; 
   let totalCount = result.totalCount; 
   let offset = result.offset; 
   console.log(items) }) 
   .catch( (err) => { 
   let errMsg = err.message; 
   let errCode = err.code; 
   }); 
   }); 
   }); 
   }); 
   });
 

PS: I can pay for some help

Already have tried this …???

…but I don’t know how to get data from the dataset/repeater…
Your REPEATER is connected to which database?
Your REPEATER is placed on a dynamic page?
How exactly is your setup?

My repeater is connected to the database where there are 3 informations:
employers(people who request to see cv)
candidate(the candidate which they want to see the cv)
dispo(boolean value: if they can see the cv or not)
in the admin page my repeater shows the pending requests for a cv and when I change the switch value to true the employers can access the cv from their members page.

I tried to do the same thing as the link you sent me but i don’t know how to get values from my data instead of the inputs.
for example:

 const recipient = $w("#input11").value;

how do i change the $w(“#input11”).value to “email of the employer to whom i just accepted the request”

How to get VALUES ???

Try this one…

$w.onReady(function () {
    $w("#repeater1").onItemReady(($item, itemData, index)=> { 
        $item("#button1").onClick((event) => {
            console.log(console.log(itemData));
        });
    });
});

And here an example…

https://russian-dima.wixsite.com/login-system/blank-2

Take a look into CONSOLE and inspect the results when clicking onto the button.

Repeater is of course connected to a DATABASE trough a DATASET.

If you need more help on this → you will find my contact in my profile.

@russian-dima I can’t access the console

@saadinioh5 Open the shown example in your BROWSER?
For example if you use GOOGLE-CHROME → Press-F12 and search for CONSOLE.

They don’t let me paste my code but here it is for now


I still can’t recieve an email