Using ajax file write instead of localstorage