Gravity Forms AJAX form not working with PopUp Pro

A GravityForms form that's supposed to work via AJAX is breaking when run in PopUp Pro popup. It's causing a lot of errors in console (see screenshot).

The issue is nearly the same as in this thread https://premium.wpmudev.org/forums/topic/issue-with-popup-pro-and-gravity-forms