justJust a qucikquick update, i. I finished this by using regular expression, but.I still thinkingthink if we only just get only the JSON formmatedformatted data forfor the quote data from the controller thenthan that should be much more better for performance. thankThank you.
SolusionSolution:
require(['jquery', 'Magento_Customer/js/customer-data', 'jquery/jquery-storageapi'], function ($) { // $("#submitbutton").hide(); var spinner = $('.ajax-checkout-cart-loader'); var form = $('form#form-validate'); var qtyfields = $('#cart-getId() ?>-qty'); var changeDected = 0; $('.page.messages').each(function () { var thismessage = $(this); thismessage.attr('id', 'messages'); }); /* form.find(qtyfields).each(function (e) { var thisfield = $(this); //console.log(thisfield); $(this).change(function () { spinner.css("display", "block"); console.log('change detected'); form.submit(); }); }); */ form.on('submit', function (e) { e.preventDefault(); $.ajax({ url: form.attr('action'), data: form.serialize(), type: 'post', success: function (response) { var parsedResponse = $.parseHTML(response); var itemSubtotal = $(parsedResponse).find(".ajax-subtotal").text(); var itemSubtotalArray = itemSubtotal.split(" "); if(itemSubtotalArray.length !== 1) { itemSubtotalArray = itemSubtotalArray.filter(s => s.replace(/\s+/g, '').length !== 0); //console.log(itemSubtotalArray); } else { location.reload(); } //console.log(itemSubtotalArray.length); var ajaxSubtototal = $('.ajax-subtotal'); for (i=0; i