Set Posts Module Query through AJAX

How do I set the query of a posts module through AJAX?
I need a custom product taxonomies filter for WC products that updates WC Products on the Shop page though AJAX. I know how to do this with pure WP (no BB), but this site is built with BB and my client wants to be able to change the layout of the posts module over time so I need to be able to modify the query of the Posts module dynamically.

I found this code, but it does not work:
$module = FLBuilderModel::get_node_by_id( $module_id );
$module->settings->query = $query_args;
$module->save();

Is this the right approach? Or if not, what else?

Where did you find that code? Genuinly curious.

You need to use the fl_builder_loop_query_args filter to adjust the uery in the post module

ChatGPT gave me the code. :wink: It is hit or miss with ChatGPT but sometimes it does steer me in the right direction.

On the filter fl_builder_loop_query_args: that works on page load, but I need to repaint/reload the whole module when a new filter value is selected. And I do not want to reload the full page, just posts module.
Do you have any idea on how to do that?

No I dont think there is a way to do that, not out of the box anyway.

Too bad. That would be a very useful feature.