The invention provides a synthesis method of an ester compound represented by the formula (1), the formula (2) or the formula (3), wherein the method comprises the steps: dissolving an aldehyde compound, sodium azide, tetrabutylammonium iodide and a halogenated compound in a solvent, or directly dissolving an aldehyde compound, sodium azide and tetrabutylammonium iodide in a halogenated compound, carrying out a reaction for 1-12 h at the temperature of 90-100 DEG C, and after the reaction is finished, postprocessing the reaction liquid to obtain the compound represented by the formula (1). The synthesis method has the advantages of mild reaction conditions, no participation of strong acids, strong alkalis or metals, simpliness, high efficiency, high yield, wide application range of substrates, amplified production potential, and relatively large potential economic value.