javascript window open passing dynamic url parameters

609 views Asked by At

Working in ColdFusion, I have a javascript function like this:

function switchyn(obj,id,karr,kval){
  ... some stuff about obj and id ....
  var fullurl = 'arch-update.cfm?karr='+karr+'&kval='+kval;
  window.open(fullurl);
 }

The window opens fine, but the parameters passed to it are "karr" and "kval"; what I want to pass are the values of karr and kval. I can't figure out how to do that, and can't find any information in an online search. Can this be done? And if so, how?

OKAY, I solved it. When I switched the single quote to double quotes in fullurl, the right thing is happening.

var fullurl = "arch-update.cfm?karr="+karr+"&kval="+kval; 

It seems strange that single quotes don't work and double quotes do; and it seems stranger that I can find no reference to that anywhere.

1

There are 1 answers

1
elnexreal On

I think you should pass the karr thing and kval thing as strings

switchyn(object, id, 'karr', 'kval')

I don't actually know what you want to do but i hope that's useful