Reputation: 21
I want to use Ajax to load an xml
file. This file is located into another folder of the root directory.
jQuery
?jQuery
?Upvotes: 2
Views: 6420
Reputation: 1155
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: 1