Answer the question
In order to leave comments, you need to log in
Ajax form submission in Yii2?
Hello.
Here is a dropdown list. When you select the desired item and click on the button, the data 'flies' to the controller, where I then work with them.
But how to make the data 'fly' to the controller without pressing the button?
In a simple script, I would write like this:
$("#mUnit").change(function() {
var unit = $("#mUnit :selected").val();
$.ajax({
type: "POST",
url: "url.php",
data: {"unit": unit},
cache: false,
success: function(response) {
$(".money").html(response);
}
});
});
Answer the question
In order to leave comments, you need to log in
then where to prescribe the script?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question