문제

In my script, I am using this code to get an image:

var image ="<img src='/uploads/carImage.png' alt='image in infowindow'>"

This works perfectly well and the carImage is displayed, but what I want to do, is to exchange carImage with a variable like:

var myImage = "carImage.png"
var image ="<img src='/uploads/myImage' alt='image in infowindow'>"

I understand, I need a specific syntax for myImage, but I am not able to find it. So my question is: What is the correct syntax for the variable myImage inside the variable image?

도움이 되었습니까?

해결책

var image ="<img src='/uploads/" + myImage + "' alt='image in infowindow'>"
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top