Refactor objectstore AJAX