I have a custom modal widget for yii2 app, it displays fine. But trying to get it to work is the issue.. right now anytime I try and send a message
via the modal, i get the error:

	yii\web\MethodNotAllowedHttpException: Method Not Allowed. This URL can only handle the following request methods: GET. 

Here is my controller that the modal should be in contact with:

namespace app\controllers;

use app\models\Message;
use app\models\forms\InquiryForm;

use Yii;
use yii\web\Controller;
use yii\web\Response;
use yii\filters\AccessControl;
use yii\filters\VerbFilter;
use yii\web\NotFoundHttpException as YiiNotFoundHttpException;

class ModalController extends Controller
{
	public function behaviors(): array
	{
		$behaviors = [];
		$behaviors['access'] = [
			'class' => AccessControl::class,
			'only' => ['inquiry],
			'rules' => [
				[
					'actions' => ['inquiry'],
					'allow' => true,
					'roles' => ['?'],
				]
			],
		];
		$behaviors['verbs'] = [
			'class' => VerbFilter::class,
			'actions' => [
				'inquiry' => 'post',
			],
		];
		
		return $behaviors;
	}
	
	public function actionInquiry(): string
	{
		$model = new InquiryForm();
		$request = \Yii::$app->request;
		if (($request->isAjax) && ($model->load($request->post()) && $model->validate())) {
		
			if ($model->process()) {

				return json_encode(['success' => true]);
			}
			else {
				return json_encode(['success' => false, 'errors' => $model->getErrors()]);
			}
		}
		else {
			// If validation fails, you can return a JSON array with the errors.
			return json_encode(['success' => false, 'errors' => $model->getErrors()]);
		}
		
		throw new BadRequestHttpException('Invalid request');
	}
}

here is the modal jquery code when render by the broswer:


			(function($) {
				 $(document).ready(function() {
				 
				 	// Modal form submission logic.
				 	$(document).on('submit', '#artwork-inquiry-modal-a3ead662-form', function(e) {
				 		
				 		e.preventDefault();// Prevent default form submission.
				 		
				 		var form = $(this);
				 		var formData = form.serialize();
				 		var submitButton = $('#artwork-inquiry-modal-a3ead662-submit');
				 		
				 		// Disable the button and show loading status.
				 		submitButton.prop('disabled', true).text('Sending...'); 
				 		
				 		$.ajax({
				 			url: form.attr('modal/inquiry'),// Action URL from the form.
				 			type: 'POST',// Request type.
				 			data: formData,// Serialized form data.
				 			success: function(response) {
				 				
				 				// Handle success response.
				 				if (response.success) {
				 					
				 					// Close modal and notify the user upon success.
				 					$('#artwork-inquiry-modal-a3ead662').modal('hide');
				 					
				 					alert(response.message);// Display success message.
				 				}
				 				else if (response.errors) {
				 					
				 					// Handle validation errors.
				 					$.each(response.errors, function(field, messages) {
				 						
				 						var inputField = $('[name="' + field + '"]');
				 						
				 						// Mark field as invalid and show error messages.
				 						inputField.addClass('is-invalid');
				 						
				 						inputField.after('<div class="invalid-feedback">' + messages.join(', ') + '</div>');
				 					});
				 				}
				 			},
				 			error: function() {
				 				
				 				// Handle any AJAX errors - show a generic message.
				 				alert('An error occurred while submitting the form. Please try again later.');
				 			},
				 			complete: function() {
				 				
				 				// Re-enable the submit button in all cases.
				 				submitButton.prop('disabled', false).text('Send Message'); 
				 			}
				 		});
				 	});
				 	
				 	// Reset form on modal close.
				 	$('#artwork-inquiry-modal-a3ead662').on('hidden.bs.modal', function () {
				 		
				 		$('#artwork-inquiry-modal-a3ead662-form')[0].reset();// Reset the form.
				 		$('#artwork-inquiry-modal-a3ead662-form .invalid-feedback').remove();// Remove error messages.
				 		$('#artwork-inquiry-modal-a3ead662-form input').removeClass('is-invalid');// Clear invalid classes.
				 	});
				 	
				 	// Set focus to the first input when modal opens.
				 	$('#artwork-inquiry-modal-a3ead662').on('shown.bs.modal', function () {
				 		
				 		$('#artwork-inquiry-modal-a3ead662-form input:first').focus();// Set focus to the first input.
				 	});
				 });
			})(jQuery);

And this is the the modal widget jquery raw code:

	protected function registerJs($id)
	{
		$jsBlock = "
			(function($) {
				 $(document).ready(function() {
				 
				 	// Modal form submission logic.
				 	$(document).on('submit', '#{$id}-form', function(e) {
				 		
				 		e.preventDefault();// Prevent default form submission.
				 		
				 		var form = $(this);
				 		var formData = form.serialize();
				 		var submitButton = $('#{$id}-submit');
				 		
				 		// Disable the button and show loading status.
				 		submitButton.prop('disabled', true).text('Sending...'); 
				 		
				 		$.ajax({
				 			url: form.attr('{$this->formAction}'),// Action URL from the form.
				 			type: 'POST',// Request type.
				 			data: formData,// Serialized form data.
				 			success: function(response) {
				 				
				 				// Handle success response.
				 				if (response.success) {
				 					
				 					// Close modal and notify the user upon success.
				 					$('#{$id}').modal('hide');
				 					
				 					alert(response.message);// Display success message.
				 				}
				 				else if (response.errors) {
				 					
				 					// Handle validation errors.
				 					$.each(response.errors, function(field, messages) {
				 						
				 						var inputField = $('[name=\"' + field + '\"]');
				 						
				 						// Mark field as invalid and show error messages.
				 						inputField.addClass('is-invalid');
				 						
				 						inputField.after('<div class=\"invalid-feedback\">' + messages.join(', ') + '</div>');
				 					});
				 				}
				 			},
				 			error: function() {
				 				
				 				// Handle any AJAX errors - show a generic message.
				 				alert('An error occurred while submitting the form. Please try again later.');
				 			},
				 			complete: function() {
				 				
				 				// Re-enable the submit button in all cases.
				 				submitButton.prop('disabled', false).text('Send Message'); 
				 			}
				 		});
				 	});
				 	
				 	// Reset form on modal close.
				 	$('#{$id}').on('hidden.bs.modal', function () {
				 		
				 		$('#{$id}-form')[0].reset();// Reset the form.
				 		$('#{$id}-form .invalid-feedback').remove();// Remove error messages.
				 		$('#{$id}-form input').removeClass('is-invalid');// Clear invalid classes.
				 	});
				 	
				 	// Set focus to the first input when modal opens.
				 	$('#{$id}').on('shown.bs.modal', function () {
				 		
				 		$('#{$id}-form input:first').focus();// Set focus to the first input.
				 	});
				 });
			})(jQuery);
		";
		$this->getView()->registerJs($jsBlock, View::POS_END);
	}