Added ajax function for saving to server

function for adding the ability to save to  server.