using Ajax to generate key value pairs