Skip to content

Magento2 how to load payment page withot loading the page.?

Magento2 how to load the payment page without loading the page.?
I want to refresh my payment page without loading into the js file.
can anyone give a solution for this?

Here is my js file with some code.

GoogleMapsLoader.done(function () {

        var enabledisable = $("#enabledisable").val();
        //  var payment_method = function(){}
      
        setTimeout(function () {
            if(!googleMapError) {
                if (enabledisable == '1') {

                var registry = require('uiRegistry'),
            progressBar = registry.get('index = progressBar'),
            firstStep = progressBar.steps()[0];

            progressBar.isProcessed(firstStep);

            if(progressBar.isProcessed(firstStep) == true){
             var street_id = uiRegistry.get('checkout.steps.billing-step.payment.payments-list.' + $("input[name='payment[method]']:checked").val() + '-form.form-fields.street').elems()[0].uid;
                    autocomplete = new google.maps.places.Autocomplete(document.getElementById(street_id),
                        {types: ['geocode']}
                    );
            
                    autocomplete.addListener('place_changed', fillInAddress);
                    $('#' + street_id).focus(geolocate);
                   }
                }
            }
        }, 3000);

    }).fail(function () {
        console.error("ERROR: Google maps library failed to load");
    });