I’m using ajaxComplete to catch AJAX requests, but only problem is I cant catch the /cart.js because there is always a random Query String.
ex- ‘/cart.js?_=1324346569‘
How can I tell this ajaxComplete to ignore query strings so my code picks up on just ‘/cart.js’?
My code –
$(document).ajaxComplete(function(event, xhr, settings) {
if (settings.url === "/cart.js") {
console.log('caught cart.js even tho it has these query parameters');
}
});
Thanks very much!
>Solution :
if (settings.url.includes("/cart.js")) {
// ....
}