Answer the question
In order to leave comments, you need to log in
Why is Ajax not working in yii2?
there is a code that should transfer the data to a file in the same folder
$('.delete').click(function () {
var qty = $(this).parent();
var chi = $(qty).children();
var chi1 = $(chi).children();
var src = $(chi1).attr("src");
console.log(src);
$.ajax({
url: "delete_img.php",
type: "POST",
data: {
src : src
},
success: function(response){
console.log(response);
}
});
});
Answer the question
In order to leave comments, you need to log in
Good afternoon.
What exactly doesn't work?
Explain in more detail.
So far, I can say that most likely you have a problem here:
You do not need to specify the file name with the extension, but the route to the controller and action.
Something like this:
You may need to use helpers Url::to() or Url::toRoute().
ps The route also depends on the UrlManager settings in the configuration file.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question