I need to parse long urls and set a variable (category) equal to one of the /folders/ in the path.
For example, a url that is
http://example.com/community/home/whatever.html
I need to set the variable equal to whatever folder path comes after /home/ in that url.
I've got this to alert me with what comes after /community/, but then the url turns to NaN and the link doesnt work. I think I'm not on the right track.
if ($(this.href*='http://example.com/community/')){
var category = url.split("community/");
alert(category[category.length - 1]);
}
Thoughts?
TIA.
this.href*=thing at all. What is that supposed to mean?$(this.href*='http://example.com/community/')is suppose to be$('[href*="http://example.com/community/"]')... /me shrugs