gerrie-govaerts
asked on
jQuery / javascript Resolve client URL
Hello
In my jQuery script I want to load content using the $.post method.
In this method I point to a specific controller etc...
Instead of using the fixed path localhost/StockManamgent ...... I would like jQuery to be able to resolve the used url for the virtual directory in IIS.
$.post("http://localhost/StockManagement/Stock/LoadBrands/" + materialId, null, function (data)
Is this possible?
Thx
In my jQuery script I want to load content using the $.post method.
In this method I point to a specific controller etc...
Instead of using the fixed path localhost/StockManamgent ...... I would like jQuery to be able to resolve the used url for the virtual directory in IIS.
$.post("http://localhost/StockManagement/Stock/LoadBrands/" + materialId, null, function (data)
Is this possible?
Thx
ASKER
No I'm sorry I can't get enough information from the location object.
Here are the possible options: http://www.javascriptkit.com/jsref/location.shtml
I actually need the virtual directory of IIS, not the controller, action etc...
Here are the possible options: http://www.javascriptkit.com/jsref/location.shtml
I actually need the virtual directory of IIS, not the controller, action etc...
If the virtual directory is there in current URL, you can get it from location.href,
else you need to send it from the server side script.
else you need to send it from the server side script.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Did you tried the two dots : ../
For example : ../../../otherDirectory/bl abla
For example : ../../../otherDirectory/bl
ASKER
var virtualPath = "<%=HttpRuntime.AppDomainA ppVirtualP ath%>";
solved my problem, so thx for giving me a good hint !
Gerrie
solved my problem, so thx for giving me a good hint !
Gerrie
You're very welcome! Thanks for the points Gerrie!
location.href;
http://www.w3schools.com/jsref/prop_loc_href.asp
let me know if i missed something