Biju Soman
Biju Soman

Reputation: 438

How can i add root path Javascript

How can I refer root path in Javascript like:

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

Upvotes: 0

Views: 786

Answers (1)

phun-ky
phun-ky

Reputation: 401

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; ';

Upvotes: 1

Related Questions