improve handling of form ajax submission