Answer the question
In order to leave comments, you need to log in
How to pass string via ajax in DRUPAL8?
Calling a php function? Which is connected to the client side via routing.
Accordingly, in js it looks like this:
$.ajax({
url: '/AddComment/' + msg + '/' + drupalSettings.path.currentLanguage,
success: function (data) {
if (data == 0) {
// отзыв добавлен
alert('Success!');
} else {
alert('Error!');
}
},
dataType: 'json',
cache: false,
async: false
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question