Reproducibility in surface enhanced Raman scattering (SERS) measurements is a challenge. This work developed a facile way to make highly dispersed uniform silver nanoparticles (AgNPs) loaded in the agar/polyacrylonitrile (PAN) nanofibers by the coupling the electrospinning technology from metal complex-containing polymer solution and in situ photoreductive technique. Agar, as hydrophilic component, was introduced into the electrospinning solution considering that its abundant hydroxyl group sites could greatly improve the contents of silver ions in the polymers because of the rich silver ion chelated with the hydroxyl group, whereas hydrophilic agar was integrated with hydrophobic PAN by -OH···N≡C- hydrogen bonds as a bridge. Meanwhile, the in situ photoreductive reaction was made under different light irradiations such as desk lamp, 365 nm UV-lamp, and 254 nm UV-lamp. High yield of stable AgNPs with highly uniform and dispersion are available in the agar/PAN nanofibers after the in situ photoreductive reaction, supplying the possibility of reproducible SERS signals. To identify that concept of proof, a facile approach for the determination of malachite green (MG) in three environmental practical samples was demonstrated by using the composite nanofibrous material irradiated by 365 nm UV-lamp, giving the minimum detection concentration of MG as low as 0.1 μmol/L with a good linear response ranging from 0.1-100 μmol/L (R(2) = 0.9960).