I have added one field for extra charges, depends on radio button selection in checkout page, its working with page refresh, but I want it to get data without page refresh.
1 Answer
I was solved that issue using below code.
jQuery( "#radio-button-id" ).change(function() {
var id = this.id;
require([
'jquery',
'Magento_Checkout/js/action/get-totals'
], function ($, getTotalsAction) {
"use strict";
$.ajax({
method: "post",
url: "<?php echo $baseUrl; ?>action/", //your ajax Url
data: { id: id},
dataType: "json",
success: function (data) {
var deferred = $.Deferred();
getTotalsAction([], deferred);
}
});
});
});