How do I pass image link to js/view?

20 views
Skip to first unread message

Maurice Waka

unread,
Oct 19, 2019, 10:48:24 AM10/19/19
to web2py-users
I need to pass the image link from the controller to js
controller function():
    imgs
= ["<img src=\"{{=URL('static','images/3.jpg')}}\" style=\"max-height='100px';border-radius:7px;\"/>"]



view page
code.....
return sendMessage(`{{=imgs}}<br>{{=XML(test_text,sanitize=True)}}`)



So far i'm getting only a string as previously stated. 

If I insert the string directly, then i'm able to view the image but not importing from the controller.

Is there a way of importing the link and inserting it into the js code ?

Better yet, a way of getting the image from database.

Regards
Reply all
Reply to author
Forward
0 new messages