using ajax post to save initial data and final data to a mongodb database