Hi i need to get current domain name or url with jquery in my MVC website.
Here is my code:
<script>
// var ROOT = 'http://192.168.1.100/';
var ROOT = HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Authority);
$(document).ready(function () {
$('.button-search').click(function () {
window.location =ROOT + "Products/Index?DepartmentId=" + $.trim($('#filter_name').val());
});
});
My website url liks like this way:
http://192.168.1.100/Home/Index
OR
www.abc.com/Home/Index
I want to fetch http://192.168.1.100/ or www.abc.com/ with the help of jquery in my above code.
Please suggest.