added functionality and tests for getting and writing data via ajax