A facile and controllable strategy to synthesize Au-Ag alloy nanoparticles within polyelectrolyte multilayer nanoreactors upon thermal reduction.