Compared with traditional luminescent materials, nonconventional luminogens have been extensively studied due to their unique properties and wide range of applications. However, the study of nonconventional luminescent polymers is rare because most luminescent polymeric materials can only emit light at high concentrations and require noble metal catalysts for synthesis. Particularly, their application in the field of metal ion detection and biological imaging is still restricted. To expand its application scope, this work designed a series of luminescent polymeric materials only containing carboxyl and amide groups, which were synthesized from poly(methyl vinyl ether maleic anhydride) and 4-(2-aminoethyl)morpholine at different molar ratios (PMVEMA/AML are 1:1, 1:2, and 1:3). The synthesized luminogens exhibited controllable luminescence colors and excellent solubility in various commonly used solvents. Additionally, the polymers can achieve luminescence in dilute solutions, and the maximal luminescence efficiencies can be up to 5.55%. At last, polymer M3 with good biocompatibility and low cytotoxicity can be used to sensitively detect Mg 2+ ions in vivo and in vitro. Notably, polymer M3 possesses the ability to target the organelle lysosome in cell imaging.