How to pull posts of a specific category using ajax?

in the sidebar displays the categories. the content displays all the posts of these categories. as you click on one category to make the upload of only those posts that belong to this category (which clicked)?

Be able to click on 1 2 or more categories to all the posts in these categories were loaded on the page. I understand you need the array to put the id of the category you want to appear and pass it.
April 7th 20 at 15:52
1 answer
April 7th 20 at 15:54
Read the documentation
In your case it will be something in this spirit
const posts = new wp.api.collections.Posts({categories: [ /* ... */]})
posts.fetch().then( /* ... */)

Find more questions by tags AJAXWordPress