changed function to store workspace

chrome does not allow js .onbeforeunload events, so we now use a jquery
ajax request