That’s a bit complicated but we have run into that before with the Subscribe Form module. I’ll try to explain that as best as I can here, but feel free to look at that module’s frontend.js and submit method of the FLSubscribeFormModule class.
First you’ll need to grab these variables to pass in your ajax request…
this.nodeClass = '.fl-node-' + settings.id;
this.form = $( this.nodeClass + ' .fl-subscribe-form' );
// These are the vars you need...
templateId = this.form.data( 'template-id' );
templateNodeId = this.form.data( 'template-node-id' );
nodeId = this.form.closest( '.fl-module' ).data( 'node' );
// Send them in your request
$.post( FLBuilderLayoutConfig.paths.wpAjaxUrl, {
action : 'your_action',
template_id : templateId,
template_node_id : templateNodeId,
node_id : nodeId
}, $.proxy( this._submitFormComplete, this ) );
On the server side, you can get the global template data like so…