Try it like,
var tagsUrl='http://localhost/zyntegra_commoditylifev2/admin/sitetag/viewTags/sid/';
var catUrl='http://localhost/zyntegra_commoditylifev2/admin/category/viewCategory/sid/';
$(function(){
$('#your-select-id').on('change',function(){
href=window.location.href;
if(href.indexOf('viewTags') !== -1){
window.location.href=tagsUrl+this.value;//append value of select element
} else if(href.indexOf('viewCategory') !== -1){
window.location.href=catUrl+this.value;//append value of select element
}
});
});
Above code may help you to complete your task.
Updated, to get only sid then try it like,
// use location.href in url to get current url
var url='http://localhost/zyntegra_commoditylifev2/admin/sitetag/viewTags/sid/110';
alert(url.split('sid/')[1]);//110
Updating @salini answer like,
function reloadpage() {
var sid = $( '#Site_selectedsiteid' ).val( );
var currentURL = window.location.pathname;
var n=currentURL.indexOf("/sid");// use '/sid' only in indexOf to remove else part
if(n!=-1) {
var newurl = currentURL.substring(0,n);
window.location.href = newurl + '/sid/' + sid;
}
}