get total post in category via ajx

The code in your question uses the old admin AJAX API, and while I would normally advise you switch to the REST API, or fix the AJAX you already have, neither are necessary.

WordPress already provides an endpoint that contains the post count and other information!

https://<yoursite>/wp-json/wp/v2/categories/<category ID>

E.g. on my own site the category with ID 5 can be requested from the REST API at /wp-json/wp/v2/categories/5 and WordPress responds with JSON data:

{"id":5,"count":6,"description":"",...etc

The information includes parent terms, URLs, metadata etc

You can also get a general list of all categories by visiting /wp-json/wp/v2/categories/ without a term ID, and you can also pass additional parameters to filter and constrain the results.

Similar endpoints exist for tags and posts, e.g. /wp/v2/posts

deneme bonusudeneme bonusu veren sitelerpulibet girişOnwin Güncel Giriştürkçe altyazılı pornocanlı bahis casino