title: How to open a Popup window which contains a graph written in javascript?
body: <p>I am using Django to implement a website and I would like to add a button such that when someone clicks it, it would open a Popup window which contains a graph written in javascript. And since I am writing the website in Django, I need to call a function in views.py to get the updated data and then draw the graph based on that. I originally want to update the graph on one page but now I would like to open a popup window. Could someone help me on how to modify the code so that the button would Popup a smaller window which contains the graph I implemented? Thanks!
  Here is my code in main.html:</p>
  
  <pre><code># I first have a button that could be clicked
  &lt;div class="col-lg-4"&gt;
   &lt;p&gt;&lt;button class="btn btn-primary" type="button" name="display_list" id="display_list"&gt;Display List&lt;/button&gt;&lt;/p&gt;
  &lt;/div&gt;
  # here is the script I used to open up a Popup window such that the returned result would be displayed on that separate window
  &lt;script&gt;
      $(document).ready(function(){
        $("#display_list").click(function(){
          $.get("display_list/", function(ret){
              $('#result').bPopup(); #I think probably I did this wrong?
           });
        });
      });
  &lt;/script&gt;
  </code></pre>
  
  <p>And here is the code I used to draw the graph in a separate html file(show_result.html):</p>
  
  <pre><code>&lt;div id="result"&gt;
  &lt;script&gt; javascript that draws a graph on html webpage. I pass the updated variable from the corresponding function in views.py to here by calling render(). &lt;/script&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Here is my function in the views.py:</p>
  
  <pre><code>def display_list(request):
     #some function implementation to get the result and put it in context
     return render(request, "show_result.html",context)
  </code></pre>
  
  <p>And this is the code in my url file:</p>
  
  <pre><code>url(r'^display_list/$', views.display_list, name='display_list'),
  </code></pre>
  
  <p>Is it possible to Popup a div in html? And what should I do in my case?</p>
  
  <p>Thanks a lot.</p>