How to pass data into the modal window via Ajax?

When you click on the form I have called the next step
$('#acception').on('click', function () {
 var ...
$.ajax({
 url: '/my-action',
 type: 'POST',
 dataType: 'json',
 data: {
...
},
 success: function (data) {
 if (data['a'] < data['b']) {
$('#my-modal').modal('show');
}
},
 error: function () {
 console.log('something went wrong');
}
});
 });

That is, in a certain case POPs up the modal window. In this modal window I need to use data['a'] and data['b']. How can I pass my-modal response of my action?
June 10th 19 at 14:48
2 answers
June 10th 19 at 14:50
success:
...
$('#my-modal').find('.modal-content').html(data);
$('#my-modal').modal('show');
...
June 10th 19 at 14:52
success: function (data) { // variable inside the () is the answer
 if (data['a'] < data['b']) {
$('#my-modal').modal('show');
}
 }

ie
success: function (data) {
$('#my-modal').html(data);
 }

Find more questions by tags AJAXYiijQuery