title: How to submit multiple values using ajax and django
body: <p>Question I want to be able to submit multiple records with my ajax form submission. This form is a partial and I want to be able to submit multiples of this form each time. This is what I have so far I can't get my textbox.vals anymore using a serialized string. Any help would be greatly appreciated.</p>
  
  <p>Here is my function </p>
  
  <pre><code>function SaveDim() {
  
      $.ajax({
          type: "POST",
          url: "/sheet/sheet_form_create.html/_dim",
          //dataType: "json",
          data: $('#form').serialize()
              +
              "&amp;description=" + $('#id_description').val() +
              "&amp;style=" + $('#id_style').val() +
              "&amp;target=" + $('#id_target').val() +
              "&amp;upper_limit=" + $('#id_upper_limit').val() +
              "&amp;lower_limit=" + $('#id_lower_limit').val() +
              "&amp;inspection_tool=" + $('#id_inspection_tool').val() +
              "&amp;critical=" + $('#id_critical').val() +
              "&amp;units=" + $('#id_units').val() +
              "&amp;metric=" + $('#id_metric').val() +
              "&amp;target_strings=" + $('#id_target_strings').val() +
              "&amp;ref_dim_id=" + $('#id_ref_dim_id').val() +
              "&amp;nested_number=" + $('#id_nested_number').val() +
              "&amp;posistion=" + $('#id_position').val() +
              "&amp;met_upper=" + $('#id_met_upper').val() +
              "&amp;met_lower=" + $('#id_met_lower').val() +
              "&amp;valc=" + $('#id_valc').val() +
              "&amp;sheet_id=" + $('#id_sheet_id').val() +
              "",
          success: function (json) {
              console.log(json);
              alert(json);
  
          }
      });
  }
  </code></pre>
  
  <p>Here is my add_dimension method in views.py</p>
  
  <pre><code>def add_dimensions(request):
    if request.method == 'POST':
      c_date = datetime.now()
      u_date = datetime.now()
      description = request.POST.get('description')
      style = request.POST.get('style')
      target = request.POST.get('target')
      upper_limit = request.POST.get('upper_limit')
      lower_limit = request.POST.get('lower_limit')
      inspection_tool = request.POST.get('inspection_tool')
      critical = request.POST.get('critical')
      units = request.POST.get('units')
      metric = request.POST.get('metric')
      target_strings = request.POST.get('target_strings')
      ref_dim_id = request.POST.get('ref_dim_id')
      nested_number = request.POST.get('nested_number')
      met_upper = request.POST.get('met_upper')
      met_lower = request.POST.get('met_lower')
      valc = request.POST.get('valc')
      sheet_id = request.POST.get('sheet_id')
      data = {}
      dim = Dimension(
            description=description,
            style=style,
            target=target,
            upper_limit=upper_limit,
            lower_limit=lower_limit,
            inspection_tool=inspection_tool,
            critical=critical,
            units=units,
            metric=metric,
            target_strings=target_strings,
            ref_dim_id=ref_dim_id,
            nested_number=nested_number,
            met_upper=met_upper,
            met_lower=met_lower,
            valc=valc,
            sheet_id=sheet_id, 
            created_at=c_date,
            updated_at=u_date)
      dim.save()
      data['description'] = dim.description;
      data['style'] = dim.style;
      data['target'] = dim.target;
      data['upper_limit'] = dim.upper_limit;
      data['lower_limit'] = dim.lower_limit;
      data['inspection_tool'] = dim.inspection_tool;
      data['critical'] = dim.critical;
      data['units'] = dim.units;
      data['metric'] = dim.metric;
      data['target_strings'] = dim.target_strings;
      data['ref_dim_id'] = dim.ref_dim_id;
      data['nested_number'] = dim.nested_number;
      data['met_upper'] = dim.met_upper;
      data['met_lower'] = dim.met_lower;
      data['valc'] = dim.valc;
      data['sheet_id'] = dim.sheet_id;
      return HttpResponse(json.dumps(data), content_type="application/json",)
  
    else:
        dim_form = DimForm()
        return render(request, 'app/_dim.html', {'dim_form': dim_form})   
  </code></pre>