added posts json, and updated controller to use ajax