use ajax for updating templates