Modal Ajax JQuery Yii Howto

Hi,

I have the following code:




<?php

use yii\web\View;

	$this->registerJs(

		"$('.modalLink').click(

			function()

			{

				var val = this.getAttribute('value');

				

				$('#modal').modal('show')

				.find('#modalContent')

				.html(val);

				return false;

			}

		);",

View::POS_READY);

?>



The ‘value’ is sent to the modal div and is displayed on the modal window.

I would like to call a Yii class and process data to be displayed on the modal, any idea how?

Something like this if it’s even possible:




<?php

use yii\web\View;

	$this->registerJs(

		"$('.modalLink').click(

			function()

			{

				var val = this.getAttribute('value');

				var data = Clients->getClientInfo(val); //Call to Yii


				$('#modal').modal('show')

				.find('#modalContent')

				.html(data );

				return false;

			}

		);",

View::POS_READY);

?>