I'm developing a wordpress plugin and looking to save data entered in a block to a mySQL table. That's it. But how can data be sent from the block editor to the server side? I've spent two weeks looking for the appropriate technique and no joy.
The scenario is simple:
registerBlockType("bla/quote-block", { //...
attributes: { quoteAtt: { type: 'string' } },
edit: function(props) {
this.props.setAttributes( { quoteAtt: getQuote() } );
// ?? Send this.props.quoteAtt to the server ??
}
I've found how to use AJAX + jQuery + wp_localize_script
but that method apparently is only suitable for sending data from the front end (eg form data). The REST API is horrendously complex and all the documentation is about reading post [meta] data, not about saving data into a table.
Thank you!