Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7872989
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T02:22:55+00:00 2026-06-03T02:22:55+00:00

the Template looks like this. <div> <H5>Status for your request</H5> <table> <tbody> <tr> <th>RequestId</th>

  • 0

the Template looks like this.

<div>
    <H5>Status for your request</H5>
    <table>
    <tbody>
    <tr>
        <th>RequestId</th>
        <th><%=id%></th>
    </tr>
    <tr>
        <th>Email</th>
        <th><%=emailId%></th>
    </tr>       
    <tr>
        <th>Status</th>
        <th><%=status%></th>
    </tr>       
     </tbody>
     </table>
</div>

This is the View Javascript that renders the page.

window.StatusView = Backbone.View.extend({

initialize:function () {
    console.log('Initializing Status View');
    this.template = _.template(tpl.get('status'));
},

render:function (eventName) {

    $(this.el).html(this.template());
    return this;
},

events: { "click button#status-form-submit" : "getStatus" },

getStatus:function(){

    var requestId = $('input[name=requestId]').val();
    requestId= $.trim( requestId );

    var request  = requests.get( requestId );

    var statusTemplate = _.template(tpl.get('status-display'));
    var statusHtml = statusTemplate( request );
    $('#results-span').html( statusHtml );
}

});

When the clicks on the input, the requestId is read and the status is appended in html element with id ‘results-span’.

The failure happens when replacing the values in html-template with variable values.

var statusTemplate = _.template(tpl.get('status-display'));
var statusHtml = statusTemplate( request );

The rendering fails with the following error.

Uncaught ReferenceError: emailId is not defined
(anonymous function)
_.templateunderscore-1.3.1.js:931
window.StatusView.Backbone.View.extend.getStatusstatus.js:34
jQuery.event.dispatchjquery.js:3242
jQuery.event.add.elemData.handle.eventHandle
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T02:22:57+00:00Added an answer on June 3, 2026 at 2:22 am

    Underscore’s _.template:

    Compiles JavaScript templates into functions that can be evaluated for rendering.
    […]

    var compiled = _.template("hello: <%= name %>");
    compiled({name : 'moe'});
    => "hello: moe"
    

    So basically, you hand the template function an object and the template looks inside that object for the values you use in your template; if you have this:

    <%= property %>
    

    in your template and you call the template function as t(data), then the template function will look for data.property.

    Usually you convert the view’s model to JSON and hand that object to the template:

    render: function (eventName) {
        $(this.el).html(this.template(this.model.toJSON()));
        return this;
    }
    

    I don’t know what your eventName is or what you’re planning to do with it but you need to get an object with this structure:

    data = { id: '...', emailId: '...', status: '...' }
    

    from somewhere and hand that to the template function:

    var html = this.template(data)
    

    to get some HTML to put on the page.

    Demo (with a fake model for illustrative purposes): http://jsfiddle.net/ambiguous/hpSpf/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a template that looks like this: <div id=PopUpTemplate style=display: none> <tr><td>${Key}</td><td>${Value}</td></tr> </div>
I have a KnockoutJS template that looks something like this: <div data-bind=template: {name: 'testTemplate',
This is an ASP.Net 2.0 web app. The Item template looks like this, for
I have template that looks like this: 100 template<size_t A0, size_t A1, size_t A2,
It looks like this template tag works like a charm for most people: http://blog.localkinegrinds.com/2007/09/06/digg-style-pagination-in-django/
I have code that looks like this: template<class T> class list { public: class
I have a template class in C++ that looks like this: template <typename T,
Suppose I have a function which looks like this: template <class In, class In2>
I have an xml that looks like this: <Config> <A></A> <Template><B/><C/></Template> </Config> and I
I have a data.frame in R that looks like this: score rms template aln_id

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.