#57925
Zac Gordon
Keymaster

Okay, having a little trouble following all of this, but hope I can help.

The first thing I’ll say that won’t be super helpful, but this model of AJAX is not really how Gutenberg wants you to be developing anymore. It would rather you build custom API endpoints that can handle these requests. That said we can probably hack this together.

In the JS for your block you will need to use the Editor Data Redux store to get the post ID https://wordpress.org/gutenberg/handbook/data/data-core-editor/#getcurrentpostid

You should be able to then pass that into your AJAX call.

Hope this helps, let me know how it goes..