check if a query string item is set in the current url
this will check and console log if a query string on this page is set to test=anything
example url is:
Test is not set: https://kruxor.com/view/code/XzLaT/
Test is set using & : https://kruxor.com/view/code/XzLaT/&test=moo
Test is set using ? : https://kruxor.com/view/code/XzLaT/?test=moo
Javascript
var field = 'test';
var url = window.location.href;
if(url.indexOf('?' + field + '=') != -1) {
console.log('test is set with ?');
}
if (url.indexOf('&' + field + '=') != -1) {
console.log('test is set with &');
}