Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


How to pass a parameter with an '&' in the string using javascript?

Posted on 2006-07-20
Medium Priority
Last Modified: 2013-12-24
I have a Javascript function that executes a webpage using ifrHidden.location.  Sometimes a string with an '&' is being passed into the URL, but it doesn't work with a string like that.  Is there a Javascript function that I can use to deal with this?


<script language="javascript" type="text/javascript">
  function jsTierChange(urlpar){
     if (urlpar == 'secondTier'){
       ifrHidden.location = 'generateSecondTierList.cfm?firstTier=' +   document.workloadrecord.selectProductListFirstTier.value;
      makeHttpRequest('selectList1.html', 'alert');
      ifrHidden.location = 'generateThirdTierList.cfm?secondTier=' + document.workloadrecord.selectProductListSecondTier.value;
     makeHttpRequest('selectList2.html', 'alert');                  
Question by:dkbailey1
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2

Expert Comment

ID: 17149473
Would replacing the ampersands with the character entity help at all?  & = &amp;    I know i have been able to get around a few errors doing that in the past.

Something you definitely could do is avoid the ampersands all together...   http://developer.fusium.com/tools/ses.cfm

This converts the ?s and &s to just slashes, which is also far more search engine friendly. Cheers!
LVL 18

Expert Comment

ID: 17150720

Use the function urlEncodedFormat()

LVL 25

Accepted Solution

James Rodgers earned 2000 total points
ID: 17154257
try using teh js functions escape and unescape


will convert it to hex, same as cf function urlencodedformat
LVL 25

Expert Comment

by:James Rodgers
ID: 17154305
glad i could help

thanks for the points

Featured Post

Understanding Web Applications

Without even knowing it, most of us are using web applications on a daily basis. Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We often confuse these web applications tools for websites.  So, what is the difference?

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
When it comes to security, close monitoring is a must. According to WhiteHat Security annual report, a substantial number of all web applications are vulnerable always. Monitis offers a new product - fully-featured Website security monitoring and pr…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question