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
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.