ajax POST call finally working. Need to figure out how to persist state. Trying to wrap my head around the idiomatic way to do this in javascript. Callback function needs to persist the state.