jquery - Passing data to bootstrap modal Django template -


the view passes list of elements template, example list of movies, , rendered in table. , each element has detail , 1 specific element has list. content of list wanna put them inside modal. i'm doing 2 loops following:

<table>   <thead>     <tr>        <td>title</td>        <td>description</td>        <td>hours</td>     </tr>   </thead>   <tbody>     {% key in movies %}      <tr>        <td>{{ key.title }}</td>        <td>{{ key.description }}</td>        <td>           <!--this button calls modal-->           {% hour in key.hours %}              <li>{{ hour }}</li>           {% endfor %}           <button type="button" class="btn btn-default" data-toggle="modal" data-target="#mymodal"></button>        </td>      </tr>     {% endfor %}   </tbody> </table> 

my modal under table outside div wraps table. pass values of second loop modal. , when user clicks on button values appear inside modal.

how can this?

you have 2 choices

  1. you can use javascript change contents of modal when button clicked.

  2. instead of 1 modal, create 1 modal each movie hours. depending on button click, different modal gets opened.


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -