@PitaJ said in How to call API from client side.:
require(['api', 'translator'], (api, translator) => {
// Your code here
});
genius! and fast reply!
i am trying to get a topic name from the category termplate with subcategories.
so i get from the api:
{
"cid" : 5 ,
"name" : .......
"........." :
.
.
.
.
"children" : [
{
"cid": 6 ,
"name" : .........
.
.
.
.
"posts" ; [
{
"pid" : 9,
"timestamp" :.....
when i try to access anything after posts (for example " children.posts.user.username")
i get an empty space.
is there a way to access this?
thx in advance
What template code are you trying?
I need more context than that. With what you have, you'd need these surrounding it somewhere in your template:
<!-- BEGIN children -->
<!-- BEGIN children.posts -->
<h1>{children.posts.pid}</h1>
<!-- END -->
<!-- END -->
Alternatively, you might just try {children.posts.0.pid}
@loopynid here's a better resource: BenchpressJS docs