print preview ajax refactor