title: pass variable into javascript object
body: <p>Can you please help with my problem</p>
  
  <p>I have the following JavaScript object:</p>
  
  <pre><code>var data = {                                   
  
      'rows[0][name]':    'foshka',
      'rows[0][tel]':    '096',
      'rows[0][opt]':    'none'
  
  };
  </code></pre>
  
  <p>The problem is that i get an error while trying to pass variable as rows index:</p>
  
  <pre><code>var i = 0;
  var data = {                                   
  
      'rows['+ i +'][name]':   'one',
      'rows['+ i +'][tel]':    '096',
      'rows['+ i +'][opt]':    'none'
  
  };
  </code></pre>
  
  <p>Thanks in advance</p>