Link to home
Start Free TrialLog in
Avatar of toooki
toooki

asked on

JavaScript syntax question (Urgent please)

I am using the following JavaScript code in a .html file for my Jetty web application:

<script id="user-template" type="text/x-handlebars-template">
    <img src="assets/images/admin/redminus.png" class="user-delete-img">
    <div class="user_name admin-users-span-1">{{username}}</div>
    <div class="user_email admin-users-span-2">{{username}}</div>
</script>

The above script works. It obtains the "username" variable as expected. I am creating another .html file where I am using the same "username" variable but I am experiencing problem with syntax and it is not working. The following are the .html file code. I have written three versions of it. Could you please let me know which one has the correct syntax? The first one did not work. If none has the correct syntax, could you please help me correct it?

1.
<script id="footer-template" type="text/x-handlebars-template">
        <img src="http://mypage.com/t.png?t=map&p={{username}}"/>
</script>

2.
<script id="footer-template" type="text/x-handlebars-template">
        <img src="http://mypage.com/t.png?t=map&p="/>{{username}}
</script>

3.
<script id="footer-template" type="text/x-handlebars-template">
        <img src="http://mypage.com/t.png?t=map&p="{{username}}/>
</script>
ASKER CERTIFIED SOLUTION
Avatar of Lucas Bishop
Lucas Bishop
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial