PDA

View Full Version : Relative path to url in Javascript


jsedrick
05-20-2004, 09:13 PM
I have a Javascript that references a hard coded url. Is there any way to have the javascript do a relative url.

My current code config looks like this..

function update_frame() {
var sUrl = "http://www.website.com/v4/process.asp" +
"?number_users=" + document.forms.roi_form.number_users.value +
"&hours_per_week=" + document.forms.roi_form.hours_per_week.value +
"&hourly_rate=" + document.forms.roi_form.hourly_rate.value +
"&software_license=" + document.forms.roi_form.software_license.value +
"&development_cost=" + document.forms.roi_form.development_cost.value +
"&ret=false"; :confused:

Roy Sinclair
05-20-2004, 09:35 PM
Just replace "http://www.website.com/v4/process.asp" with the appropriate relative URL.

jsedrick
05-20-2004, 09:50 PM
That's the way I have it now which works. But I have a subfolder, v4, that do all my testing on. SI would prefer to have the linke reference the files from the root, like /process/file.asp instead of http://www.website.com/process/file.asp that way I don't have to change the url when I copy the file to the "live" server

Any idea how to do this?
Jody

immedicable
05-20-2004, 10:38 PM
../process/file.asp