I have URL like :
http://domain/catergory/Education?max-post=5/
How can I get Education
from that URL. Education is in between "/"
and "?"
.
Thanks for your help.
I have URL like :
http://domain/catergory/Education?max-post=5/
How can I get Education
from that URL. Education is in between "/"
and "?"
.
Thanks for your help.
You can use a regexp for it:
var url = 'http://domain/catergory/Education?max-post=5/';
var val = url.match(/\/([^\/\?]*)\?/)[1];
To understand the regexp you can use this site: http://regex101.com/r/aQ3yF1#javascript
Try
var url = window.location.pathname;
value = url.replace('http://domain/catergory/','');
value = value.substring(0, s.indexOf('?'));
var url = "http://domain/catergory/Education?max-post=5/";
var arr = url.split("?")[0].split("y/");
var edu = arr[1]
console.log(edu);