Skip to content

Instantly share code, notes, and snippets.

@nsdevaraj
Created December 16, 2014 11:55
Show Gist options
  • Save nsdevaraj/d2053e67a81a7c402a0b to your computer and use it in GitHub Desktop.
Save nsdevaraj/d2053e67a81a7c402a0b to your computer and use it in GitHub Desktop.
use the current url where js is present
var jsonUrl;
var sc = document.getElementsByTagName("script");
for(idx = 0; idx < sc.length; idx++)
{
s = sc.item(idx);
if(s.src && s.src.match(/render\.js$/))
{
var currentLoc = 'http://127.0.0.1:60373/sap/bi/bundles/vbi/viz/ext/solidgauge/vbi_viz_ext_solidgauge-src/js/render.js'
jsonUrl= currentLoc.replace('render.js','utils/data/us.json');
return jsonUrl;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment