How to get the root path in JavaScript?
        Posted  
        
            by Axel
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Axel
        
        
        
        Published on 2010-03-17T21:11:27Z
        Indexed on 
            2010/03/18
            9:21 UTC
        
        
        Read the original article
        Hit count: 293
        
I am using mod_rewrite to remap the URLs in my website in the following format:
http://www.mydomain.com/health/54856
The problem is that I am making AJAX calls to a file: http://www.mydomain.com/login.php
And I don't want to write the FULL url or even use the ../ trick because there isn't a fixed level of folders.
So, what i want is something to access the login.php from the root, whatever the domain name is:
 $.ajax({
    type: "POST",
    url: "http://www.mydomain.com/login.php"
 });
© Stack Overflow or respective owner