0

there is a request that is being made on the site, but I didn't make this request, but I need to get the result of it. Is there anything I can do?

1 Answer 1

0

You can use global listener. Here is example from the vendor/magento/module-customer/view/frontend/web/js/customer-data.js where the customer data is updated when customer changes something on the frontend:

/**
 * Events listener
 */
$(document).on('ajaxComplete', function (event, xhr, settings) {
    customerData.onAjaxComplete(xhr.responseJSON, settings); // Write your code here
});

This way you can get any response to any ajax call, but you should determine if it's target request or not.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.