API controller for JSON implemented using MVC framework Yii along with Ajax implementation for total posts