add ajax functionality

hmm tried it this way and it gave me undefined.