title: Including a template does not render the variable value
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/5541312/how-to-pass-the-variable-from-included-template-to-the-template-where-it-is-inclu">how to pass the variable from included template to the template where it is included?</a>  </p>
  </blockquote>
  
  
  
  <p><strong>main.html</strong></p>
  
  <pre><code>{% extends "new-base.html" %}
  {% block side-bar %}
  &lt;div id="foo1"&gt;
       {% for foo in foo_list %}
       {{ foo_id }} // ???
           {% ifequal foo.id foo_id %}
            &lt;li id="my-id_{{ foo.id }}" class="select"&gt;&lt;a href="#."&gt;
           {% else %}
            &lt;li id="my-id_{{ foo.id }}" class="no-select"&gt;&lt;a href="#."&gt;
           {% endifequal %}
        {% endif %}
       {% endfor %}
      &lt;/ul&gt;
    &lt;/div&gt;
  {% endblock side-bar %}
  
  {% block content %}
  &lt;div class="content" id="main-content"&gt;
   {% include "template/part.html" %}
  &lt;/div&gt;
  {% endblock content %}
  </code></pre>
  
  <p><strong>part.html</strong></p>
  
  <p>This html is get included in the <code>main.html</code></p>
  
  <p><strong>views.py</strong></p>
  
  <pre><code>if request.is_ajax():
      t = get_template('part.html')
      html = t.render(Context({'foo_id': foo_id}))
      return HttpResponse(html)
  </code></pre>
  
  <p>In response it will send the <code>part.html</code> But I am using <code>foo_id</code> it into <code>main.html</code>. <code>main.html</code> 
  included the <code>part.html</code> But <code>{{ foo_id }}</code> in <code>main.html</code> is not giving me any value. I indicated the position by <code>???</code> But when I render whole template (not adding the html
  data in the div ) then it gives the proper data.</p>
  
  <p><strong>jquery</strong></p>
  
  <pre><code>$.ajax({
      type:'GET',
      cache: 'false',
      url:"/foobar/",
      success:function(data) {
          $('#main-content').html(data);
      }
  });
  </code></pre>