I need an advice. When a user's page is loaded, some data is loaded separately via ajax so as not to slow down the page loading. The user can edit and delete some data, there are corresponding buttons for this. How can I hide these buttons from third parties who will view profile? In other places, I just check the user id and the viewer id, but in this place the content is created in javascript and there I cannot use php code.
@jlrdw I am getting the data and just building the layout. This data does not depend on who requests it, it contains the usual content and id, which I use in the delete / edit button
So far, my last option was just the usual hiding / showing content, as you suggested
@deekepMaks but if it's the authenticated user, then you can pass that in the Json response, that would be the condition I mentioned. You need a condition passed in that response to determine whether to show or hide buttons.
A little hard to give much advise when we can't see any of your code, but why not pass a isUser boolean field with your json response. Then if the user is the profile user you can construct the buttons, otherwise don't.