By ssnobben on Tuesday, 23 October 2018
Posted in Technical Issues
Replies 2
Likes 0
Views 668
Votes 0
Hi ,

one question about your opion & advice.

I planning in future to use an Joomla cAPI extension https://www.annatech.com/ https://getcapi.org/ with EasySocial 3 too and I see there is some discussion how to implement it with social components like Jomsocial etc https://joomla.stackexchange.com/questions/146/what-is-the-proper-way-to-make-an-ajax-call-in-component

What is the proper way to make an AJAX call in EasySocial? Is there any obstacle that make it not work well with Joomla RESTful API Platform cAPI you think?

thnks
Some documents about cAPI https://learn.getcapi.org/
·
Tuesday, 23 October 2018 17:20
·
0 Likes
·
0 Votes
·
0 Comments
·
To be frank with you, I am not familiar with this cAPI Platform, but this is how to make an ajax call in Easysocial.

You can take a look this delete invited friend request example from user profile page (http://take.ms/RXWud).

1. This is the theme generated that delete option
- JoomlaFolder/components/com_easysocial/themes/wireframe/friends/default/invites.php

2. Added this 'data-es-invitation-delete' data attribute from this delete option

3. When the user click on this delete option, there got a onclick event from the script under this file.
- JoomlaFolder/components/com_easysocial/themes/wireframe/friends/default/invites.js


EasySocial
.require()
.done(function($){

$('[data-es-invitation-delete]').on('click', function() {

var parent = $(this).closest('[data-item]');
var id = parent.data('id');

EasySocial.ajax( 'site/controllers/friends/deleteInvites', {
"id": id
}).done(function() {
parent.remove();
});
});
});


4. Then it will call this function 'deleteInvites' from this file JoomlaFolder/components/com_easysocial/controllers/friends.php and delete that invited friend data.
·
Tuesday, 23 October 2018 23:33
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post