Django - Retrieve Values of Checkboxes
<p>How do I retrieve the values of multiple html checkboxes and send it back to my view? The checkboxes have the same name:</p>

<pre><code>&lt;input type="checkbox" value="document_1" name="checkbox_1"&gt;
&lt;input type="checkbox" value="document_2" name="checkbox_1"&gt;
&lt;input type="checkbox" value="document_3" name="checkbox_1"&gt;
</code></pre>

<p>I'm trying to give the user the option the select multiple checkboxes and then send that data back to a Django view.</p>

<p>My hope is to send the data back to a Django view as a list of all the selected values with Ajax, although I'm just working out a regular form right now. </p>

<p>So If I selected the first and last checkbox, I would send this back to the view:</p>

<pre><code>data = ["document_1", "document_3]
</code></pre>

<p>I have tried setting a variable like this: </p>

<pre><code>var data = $('.checkbox_1:checked').val()
</code></pre>

<p>and I'm still working on the Ajax but haven't been able to make much progress. </p>