I am trying to update whole minicart content but my ajax call is not working
$.ajax({
url: "my_controller_url",
type: "POST",
success: function (result) {
$(".minicart").html(result);
}
});
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.
Sign up to join this communityI am trying to update whole minicart content but my ajax call is not working
$.ajax({
url: "my_controller_url",
type: "POST",
success: function (result) {
$(".minicart").html(result);
}
});
First of all run ajax URL directly to check if your URL is working.
If it is working, then you need to add your ajax
in require
function and use jQuery
instead of $
sign, like this:
require([
'jquery'
], function($){
jQuery.ajax({
url: "my_controller_url",
type: "POST",
data: "",
success: function (res) {
jQuery(".minicart").html(result);
}
});
});