title: Posting the data using the for loop for each array in the inside array with Ajax
body: <p>My data include one Sensor and too many Alarm related this Sensor. I am trying create many Alarm using for loop. Then I want to use this Alarm variable in Sensor json object.
  However I couldn't this. Please help me. How can I create Alarm array and then send as a parameter this array to Sensor object.</p>
  
  <p>The data package I want to send is as follows:</p>
  
  <pre><code>  "Alarm": [
      {
        "AlarmCommunication": [
          {
            "AlarmCommunicationID": 0,
            "AlarmId": 0,
            "CommunicationTypeId": 1
          }
        ],
        "AlarmWorkingTime": [
          {
            "AlarmWorkingTimeID": 0,
            "AlarmId": 0,
            "WorkingTimeTypeId": 1
          }
        ],
        "AlarmID": 0,
        "SensorId": 0,
        "DensityTypeId": 5,
        "DurationTime": 30,
        "isActive": true
      }
    ],
      "Alarm": [
      {
        "AlarmCommunication": [
          {
            "AlarmCommunicationID": 0,
            "AlarmId": 0,
            "CommunicationTypeId": 1
          }
        ],
        "AlarmWorkingTime": [
          {
            "AlarmWorkingTimeID": 0,
            "AlarmId": 0,
            "WorkingTimeTypeId": 1
          }
        ],
        "AlarmID": 0,
        "SensorId": 0,
        "DensityTypeId": 3,
        "DurationTime": 40,
        "isActive": true
      }
    ],
    "SensorID": 0,
    "RoadId": 11,
    "GivenSensorID": "TEST",
    "LocationX": "32.55",
    "LocationY": "42.56",
    "SegmentId": 91,
    "isActive": true
  }
  </code></pre>
  
  <p>I tried posting it with the following code blog, but it didn't work.
  Where am i making a mistake</p>
  
  <pre><code>for (var i = 1; i &lt;= alarms.length; i++) {
          data.Alarm.AlarmCommunication.push({
              "AlarmCommunicationID": 0,
              "AlarmId": 0,
              "CommunicationTypeId": 1
          });
          data.Alarm.AlarmWorkingTime.push({
              "AlarmWorkingTimeID": 0,
              "AlarmId": 0,
              "WorkingTimeTypeId": 1
          });
          data.Alarm.push({
              "AlarmID": 0,
              "SensorId": 0,
              "DensityTypeId": 1,
              "DurationTime": 1,
              "isActive": 1,
              "AlarmCommunication": [],
              "AlarmWorkingTime": []
          });
     }
      $.ajax({
          url: '/Operation/Add',
          dataType: 'json',
          type: 'POST',
          contentType: 'application/json',
          data: JSON.stringify({
              "SensorID": 0,
              "RoadId": 5
              "GivenSensorID": 3,
              "LocationX": location_x,
              "LocationY": location_y,
              "SegmentId": SegmentID,
              "isActive": 1,
              "Alarm": []
          })
      });
  </code></pre>