Reputation: 31
I want to use Ajax to load an xml
file. This file is located into another folder of the root directory.
jQuery
?jQuery
?Upvotes: 3
Views: 6435
Reputation: 1165
This returns the root/hostname:
window.location.hostname
This returns the path of parent folder.
var string1 = "../example/index.html";
var string2 = string1.replace(string1.split("/").pop(),"");
string2=../example/
Upvotes: 2