Tag Archives: javaScript

ASP.Net MVC5: Get Base URL in JavaScript

* Get base url   <script type="text/javascript"> var baseUrl = ‘@Url.Content("~")’; </script>   * Use it in ajax, for example:  $(document).ready( function () { var vm = new ViewModel();  $.ajax({ url: baseUrl + ‘api/menu/’,  

Posted in asp.net, JavaScript | Tagged , , | Leave a comment