I have a programmes page which contains tags and subcategories. On clicking a tag, the url of the page changes to something like this:
localhost:3000/programmes/global-entrances/gre?tag_id=2&url=%2Ftag_sort%2F2%3Fcategory%3Dgre
Based on which tag has been clicked I want to change the tag color, so I need to get the tag_id value from the url.
First I checked whether the url contains a string called tag_id
by doing this.
$(document).ready(function(){
var url = window.location.href;
substring = "tag_id";
if(url.indexOf(substring) > -1){
// if true then get the tag_id value
}
});
Now I got stuck with it.