Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Parameterized URL String

Status
Not open for further replies.

vdefazzio

IS-IT--Management
Jan 22, 2008
1
US
I've searched but haven't found any suitable solutions to my problem, so I'm reaching out for a little help with this.

What I am trying to do is send a Pipe delimited, Parameterized URL String based on the input of a form:
What I want to send, for example= (url has been sanitized)
=$0000000000|KP39|Bob Survey|Sue Survey|~5555551212|9999999999|0|0|0|0|0|0|1234 here lane|ACS@TPV =$

What shows up in the address bar:
e%20lane|ACS@TPV%20=$

How can I remove the forward slash after .com, as well as send real spaces instead of %20's.
I can write it to screen, which happens to be the first example, and it is exactly as I want it. When I window.location = it shows up as the latter example.
My code:

<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function processForm(form) {
var ordernumber = form.ordernumber.value;
var centercode = form.centercode.value;
var contactname = form.contactname.value;
var billingname = form.billingname.value;
var billingphone = form.billingphone.value;
var phonewtn = form.phonewtn.value;
var localservice = form.localservice.value;
var tollservice = form.tollservice.value;
var longdistanceservice = form.longdistanceservice.value;
var localservicefreeze = form.localservicefreeze.value;
var tollservicefreeze = form.localservicefreeze.value;
var longdistanceservicefreeze = form.longdistanceservicefreeze.value;
var serviceaddress = form.serviceaddress.value;
var posturl = "xxxxxxx.xxxxxx-xx.com?ACS@TPV";
var post= (posturl + " =$" + ordernumber + "|" + centercode + "|" + contactname + "|" + billingname + "|~" + billingphone + "|" + phonewtn + "|" + localservice + "|" + tollservice + "|" + longdistanceservice + "|" + localservicefreeze + "|" + tollservicefreeze + "|" + longdistanceservicefreeze + "|" + serviceaddress + "|" + "ACS@TPV =$")

//document.write(post);
window.location = post;
//End -->

</script>
 
How can I remove the forward slash after .com, as well as send real spaces instead of %20's.

Why are you wanting to do this, out of curiosity?

I don't think that you'll be able to remove the forward slash after the .com because I don't think you can append querystring values to the address without it.

Additionally, spaces are invalid characters in urls. You are not going to get the url to display with spaces in your browser. However, if you're trying to extract information from the querystring after the page has loaded, replace all the escaped characters in the querystring by using the unescape function.

Code:
var url = window.location;
alert(unescape(url));

-kaht

Lisa, if you don't like your job you don't strike. You just go in every day and do it really half-assed. That's the American way. - Homer Simpson

[small]<P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <.</B>[/small]
 
The %20 is the html code for a blank space as you can't have true blank spaces in URL. Not really sure how you can remove the / after xxx.com as it is trying to search in that root.

--Dan
Whenever you find yourself on the side of the majority, it is time to pause and reflect.
Mark Twain
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top