Pass variable as argument to setStringParameterNoEscape('name', 'value' );

Marc White
Tera Contributor

Trying unsuccessfully to pass a populated variable instead of a string.

This works

r.setStringParameterNoEscape('engine', '192.168.5.5:1671' );

This does not

var target = "192.168.5.5:1671"

r.setStringParameterNoEscape('engine', target );

 

 

6 REPLIES 6

I have encountered the same issue. I believe either a bug exists or the documentation for the 

setStringParameter(String name, String value)

needs to be changed to specify that, as @Marc White says

 name only accepts plain text enclosed in single quotes. Period. 

zur0
Tera Contributor

I know that it is old post, but I have faced similar issue and I resolved that by encoded URI. I this case it should be encodeURI(target) and then passing it to r.setStringParameterNoEscape as second param. I hope that it helps someone 🙂