Poseidon1003
Programmer
Hi I'm newbie in this area.
How can I use html variables in javascript function embraced in html?
Here's my code "sitelist.html".
<body>
<div class="content">
<table id="rptmenus" width="78%" height="50" border="0">
<tr> <th> Site Settings </th> </tr>
<tr> <td><p>You are currently logged in as: {{user.username}} </p></td> </tr>
<tr class="alt"> <td> Site/Location information file (text or csv) </td> </tr>
<tr> <td><p>File opened: {{filename}} </p></td> </tr>
</table>
<table id="sites" width="78%" border="0">
<tr> <script type="text/javascript">loadSite(filename)</script> </tr>
</table>
</div>
</body>
This html is called by
render_to_response('sitelist.html', {'user':user, 'filename':filename})
in "views.py".
In html code, I'm going to call "loadSite" function with "filename" variable from render_to_response.
{{filename}} in html displays desired filename, but "loadSite(filename)" didn't work properly.
How can I call "loadSite" with {{filename}} variable?
How can I use html variables in javascript function embraced in html?
Here's my code "sitelist.html".
<body>
<div class="content">
<table id="rptmenus" width="78%" height="50" border="0">
<tr> <th> Site Settings </th> </tr>
<tr> <td><p>You are currently logged in as: {{user.username}} </p></td> </tr>
<tr class="alt"> <td> Site/Location information file (text or csv) </td> </tr>
<tr> <td><p>File opened: {{filename}} </p></td> </tr>
</table>
<table id="sites" width="78%" border="0">
<tr> <script type="text/javascript">loadSite(filename)</script> </tr>
</table>
</div>
</body>
This html is called by
render_to_response('sitelist.html', {'user':user, 'filename':filename})
in "views.py".
In html code, I'm going to call "loadSite" function with "filename" variable from render_to_response.
{{filename}} in html displays desired filename, but "loadSite(filename)" didn't work properly.
How can I call "loadSite" with {{filename}} variable?