Closed elsmore closed 10 years ago
The only way to do it is in a separate ajax request/template using the entry ids provided in the parent entry.
Ok, thanks for your quick reply.
I don't suppose you have an example of how I might implement this? Please excuse my ignorance when it comes to AJAX!
I’ll try to show a brief example.
First template (site/main_json):
{exp:json:entries channel=“your_main_channel”}
Second template (site/related_json):
{exp:json:entries channel=“your_related_channel” dynamic_parameters=“entry_id"}
Ajax:
$.ajax({
url: ‘/site/main_json’,
dataType: ‘json’,
success: function(data) {
if (data.your_playa_field) {
$.ajax({
url: ‘/site/related_json’,
dataType: ‘json’,
data: {
entry_id: data.your_playa_field.join(‘|’) // EE requires its parameters as pipe delimited strings
},
function(data) {
// this will be a JSON object of your related entries
}
});
}
}
});
I hope that helps. That’s about the best I could do!
Thanks Rob, I appreciate your help!
Is there some way of getting data from Playa fields instead of the entry_id for the related entry?
Thanks in advance.