Synthesis and application of ionic molecular and polymeric materials