Running a function with ajax


Need some help from the clever people of WPMUDEV on this. First, what I'm trying to accomplish:

We are currently developing a student community website, and it uses myCRED plugin for a points system (much like WPMUDEV's points system actually). We would like to give the user points each time he/she shares a piece of content on social media. For social sharing, we are using Mashshare plugin, and found it to be great.

Please consider this page;

As you can see on the top of the page, there are Mashshare icons to share the content. Now, myCRED does not automatically work with Mashshare out of the box, but we can add custom hooks to myCRED to make it work with anything, as described below;

So, what I'd like to do is, use AJAX to capture a click on the buttons (the easy part) and run a custom hook function in myCRED similar to the one above. I can figure out how to construct the function for myCRED but I don't know how I can run a function with AJAX.

I'd be glad if you can help me run the function described in myCRED tutorial above on the click of the button with AJAX. Thanks very much for your help.