Move all AJAX functions to helper