Want more features on Pastebin? Sign Up, it's FREE!
Guest

Loopback jQuery AJAX Request

By: a guest on Feb 28th, 2012  |  syntax: None  |  size: 0.27 KB  |  views: 21  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. http://www.mydomain.com/some/subdir/file.php
  2.        
  3. $.post('/some/subdir/file.php', ...);
  4.        
  5. /**
  6.  * Retrieves the current root URL.
  7.  *
  8.  * @return string the root URL
  9.  */
  10. $.fn.rootUrl = function() {
  11.         var url = location.href;
  12.         return url.substring(0, url.indexOf('/', 7));
  13. };
clone this paste RAW Paste Data