title: Adding item to a sharepoint list using rest api
body: <p>I have a list having columns naming - Column1,Column2,Column3..etc.
  Items are added to the list using rest api. 
  Can the data to these fields be set using a loop. ?It need it to be set dynamically depending upon a number from user- so require a loop. How will the code be..</p>
  
  <p>My current code is below: </p>
  
  <pre><code>$.ajax({
      url: _spPageContextInfo.webAbsoluteUrl +"/_api/Web/Lists/GetByTitle(listname)/Items", 
      type: "POST",
      headers: {
          "accept": "application/json;odata=verbose",
          "X-RequestDigest": $("#__REQUESTDIGEST").val(),
          "content-Type": "application/json;odata=verbose"
      },
      data:  __metadata: { 'type': 'SP.Data.customlistListItem' },
                          Title: 'title',
                          Column1:'value1',
                          Column2:'value2',
                          Column3:'value3',
                          Column4:'value4',
                          Column5:'value5',
      success: function (data) {
          //console.log(data);
          alert('added');
  
  
  
      },
      error: function (error) {
          //alert(JSON.stringify(error));
          alert('Some error occured. Please try again later.');
      }
   });
  </code></pre>