lundi 21 janvier 2019

Using string variable for img tag inside quotes

I'm trying to create a email template for my app and using mailgun service for that. There's a img tag in my html template.

"<img src=\"imgURL\" style=\"width:100px;height:100px\">"+

I want this image to change based on the email type. So i have a if condition to change the image url according to the email type.

        if(type == "A_post"){
            img_url = "imgURL";
        }else if(type == "comment"){
            img_url = "imgURL";
        }

So i'm trying to use img_url in my img tag. But the img tag is already within quotes. How can i achieve something like this?

"<img src=\"img_url\" style=\"width:100px;height:100px\">"+

Aucun commentaire:

Enregistrer un commentaire