Question

How can I refer root path in Javascript like:

$.blockUI.defaults.growlCSS['background'] = 'url(~/Styles/images/check48.gif) no-repeat 10px 10px #000; ';
Was it helpful?

Solution

Biju was wondering how to solve this in javascript, a way to do it is:

var path = window.location.protocol + '//' + window.location.host + '/'; // or whatever you want to set it to
$.blockUI.defaults.growlCSS['background'] = 'url(' + path + 'Styles/images/check48.gif) no-repeat 10px 10px #000; ';
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top