title: How to pass simple array to ajax request?
body: <p>I've got the following code:</p>
  
  <pre><code>$("form").submit(function(e) {
        e.preventDefault();
        var ris = new Array();
        for (var j = 0; j &lt;= i; j++)
          ris[j] = [($("[name=ris" + j + "]").val())];
        $.ajax({
          url: "crea_sondaggio.php",
          type: "POST",
          data: JSON.stringify({
            ris: ris
          }),
        });
      });
  </code></pre>
  
  <p>with this array: </p>
  
  <pre><code>var ris = new Array();
        for (var j = 0; j &lt;= i; j++)
          ris[j] = [($("[name=ris" + j + "]").val())];
  </code></pre>
  
  <p>and I want to send it to Ajax. Is it right: </p>
  
  <pre><code>data: JSON.stringify({
        ris: ris
      }),
  </code></pre>
  
  <p>How can I fix?</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p><strong>js/php</strong></p>
  
  <pre><code>&lt;form action="crea_sondaggio.php" method="post"&gt;
       ...other code here....
  &lt;/form&gt;
  $("form").submit(function(e) {
                  var ris = new Array();
                  for (var j=0; j&lt;=i; j++) 
                      ris[j] = [($("[name=ris"+j+"]").val())];
                  $.ajax({
                      url: "crea_sondaggio.php",
                      type: "POST", 
                      data: {ris: JSON.stringify(ris)},
                      dataType: "html",
                      success: function() {
                          alert("OK");
                      },
                      error: function(err, msg) {
                          alert ("Chiamata fallita " + msg);
                      }
                  });
              });
  </code></pre>
  
  <p><strong>crea_sondaggio.php</strong></p>
  
  <pre><code>$ris = $_POST['ris'];
  echo $ris; 
  </code></pre>
  
  <p>But page crea_sondaggio.php is empty and it doesn't appear the output $ris. How can I fix?</p>