settings object containing base_url


/ Published in: JavaScript
Save to your folder(s)



Copy this code and paste it in your HTML
  1. function get_settings() {
  2. var doc_location = document.location.href;
  3. var url_strip = new RegExp("http:\/\/.*\/");
  4. var base_url = url_strip.exec(doc_location);
  5.  
  6. var settings = { "base_url" : base_url }
  7.  
  8. return settings;
  9. }
  10.  
  11. function (){
  12. settings = get_settings();
  13. $(function(){
  14. console.log(settings.base_url);
  15. });
  16. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.