Hi all,
I need to isolate an id in a string using javascript. I've managed to get to the part where I get to the id but then I want to be able to string the rest of the string so that it only leaves the id number such as this:
var urlString = "http://mysite.co.za/wine/wine-blog/blogid/24/parentblogid/15.aspx";
// if the blogid is found in the url string
if (urlString.indexOf("blogid") != -1) {
alert("blogid id found");
// we strip the string to isolate the blogid
url = urlString.substring(urlString.indexOf("blogid") + 7);
//alert("url : " + url)
blogId = url.substring(0, urlString.indexOf("/"));
alert("blogId : " + blogId)
}
I need to be able to strip everything after the 24.
Thanks all.