There are two Methods of updating the minicart
Method 1: Using sections.xml
Create sections.xml file under app/code/Vendor/Module/etc/frontend
directory
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Customer:etc/sections.xsd">
<action name="module/ajax/index">
<section name="cart"/>
</action>
</config>
Note: Put your ajax call URL in place of 'module/ajax/index'
Method 2: Using customerData dependency in the script tag
<script>
require([
'jquery',
'Magento_Customer/js/customer-data'
], function ($, customerData) {
$.ajax({
type: "post",
url: "your_url",
data: {data : yourData},
cache: false,
success: function(response) {
// reload the minicart
var sections = ['cart'];
customerData.reload(sections, true);
}
});
});
</script>