Changing Image SRC with a value saved in a cookie

I am going in circles here. I have a URL properly saved in a cookie. When I try to replace the src of an image, it does NOT work. Of course, if I place set the URL directly it works.
//Example 1 - does not work
let sPhoto = session . getItem ( “myimage” )
$w ( “#img” ). src = sPhoto

//Example 2 - does not work
let sPhoto = ‘"’ + session . getItem ( “myimage” ) + ‘"’
$w ( “#img” ). src = sPhoto

//Example 3 - works
let sPhoto = “
$w ( “#img” ). src = sPhoto

I can properly print out session . getItem ( “myimage” ) to the screen, so it is 100% being set and retrieved properly. I’ve tried encoding the URI before saving to the cookie, then decoding it, I’ve tried .toString() even though it is a string. I am completely stumped. Any thoughts?

Thank you!

So if example 1 does not work but example-3 works, what could be the reason ?

Maybe you get something else from —> session . getItem ( “myimage” ) <---- then you expect?

Did you check it?
What do you get here in CONSOLE ?


	let sPhoto=session.getItem("myimage");

What is the result?
So if you get NOTHING, then you found your issue.