I know this question seems to be around a bit, but 90% of the answers point to a solution that is not working for me (indexof > -1).
if ( window.location.href.indexOf("product=3") > -1 || window.location.href.indexOf("product=2") > -1 ) {
alert('success');
}else {
alert('nothing');
}
The problem is that for product 30 this also alerts success.
Is there a simple solution that can detect an exact match in the url query string.
For example
mycoolsite.com/cart/?type=buynow&product=30
How can we check with javascript or jquery if the product equals 30?