You would need to look at the ACF JS API https://www.advancedcustomfields.com/resources/javascript-api/. There is probably an action that fires for this, but you’d need to populate all of the content in the flex field using JS rather than PHP and I don’t know of any examples of doing something like this.