title: Checking a selected form option in Django and updating page
body: <p>So I'm using django and I have a page/template that looks like (simplified to only the relevant parts)</p>
  
  <pre><code>&lt;select id="printerSelect" name="printer_id"&gt;
  &lt;option&gt;Select Printer&lt;/option&gt;                             
  &lt;option&gt;printer1&lt;/option&gt;                           
  &lt;option&gt;printer2&lt;/option&gt;                           
  &lt;/select&gt;
  </code></pre>
  
  <p>and later on I have something like</p>
  
  <pre><code>&lt;div id="printerInfo"&gt;
  No printer Selected
  &lt;/div&gt;
  </code></pre>
  
  <p>So the printerSelect list is populated by querying a mongodb database, finding the printer names and dynamically putting them in the list on a page load through django templates/context stuff. Is it possible to know when a user selects an option in that list and have it change the contents of the printerInfo div?</p>
  
  <p>I know jquery as well if that helps. I think the main questions are:</p>
  
  <ol>
  <li>How to tell when a user changes a selection in the list (probably can be done with a binded jquery listener for it?)</li>
  <li>How to query the database for additional information based on that selected option</li>
  </ol>
  
  <p><strong>Edit</strong></p>
  
  <p>So I actually came up with a hacky way of doing this using what Sushanth suggested. Basically in the django template you create a bunch of divs that hold the additional information that is being requested from the database and that will eventually go into printerInfo. </p>
  
  <p>Then using jquery you have a function that saves that information into variables, using "printer1", "printer2" as map keys to that information. Then you remove these divs. Because this is all done right when the page is loaded the user never sees any of this.</p>
  
  <p>Then whenever an item is selected, you use the selection text as a key to the map containing the value/text that's going in the printerInfo div. Then it's just a simple matter of changing its text field to whatever</p>