I added custom script:
wp_enqueue_script(\'functions\', get_bloginfo(\'template_url\') . \'/js/functions.js\', \'search\', null, false);
I
If the javascript file is loaded from the admin dashboard, this javascript function will give you the root of your WordPress installation. I use this a lot when I'm building plugins that need to make ajax requests from the admin dashboard.
function getHomeUrl() {
var href = window.location.href;
var index = href.indexOf('/wp-admin');
var homeUrl = href.substring(0, index);
return homeUrl;
}