title: Pass array of form element using jquery ajax
body: <p>I have a form and I need to pass it to PHP page
  this is my HTML part , </p>
  
  <pre><code> for ($j=0;$j&lt;2;$j++) {
          ?&gt;
  
          &lt;tr&gt;&lt;th&gt;&lt;div class="col-xs-2"&gt;
  
  
                      &lt;input class="form-control input-lg" name="Time[]" id="inputlg" type="text" value="" style="width:120px; height:30px;"&gt;
  
                      &lt;/div&gt;&lt;/td&gt;
          &lt;?php   
          for ($s=1;$s&lt;=count($days)-6;$s++) {
              ?&gt;
              &lt;td&gt;&lt;div class="col-xs-2"&gt;
  
                      &lt;input class="form-control input-lg" name="Subject[]"  id="Subject&lt;?php echo $j.$s ?&gt;" type="text" value="" style="width:120px; height:30px;"&gt; 
                      &lt;input class="form-control input-lg" name="Day[]" id="inputlg" type="hidden" value="&lt;?php echo $days[$s]; ?&gt;" style="width:120px; height:30px;"&gt;
  
                      &lt;/div&gt;&lt;/td&gt;
              &lt;?php   
          }
          echo "&lt;/tr&gt;";
  
  
      }
  </code></pre>
  
  <p>and this is my jquery code ,</p>
  
  <pre><code>$(document).ready(function() {
      $("#btnSubmit").click(function() {
          var Sub = $('[name=Subject]').val();
  
          $.ajax({
              url: 'sample.php',
              type: 'post',
              data: 'Subject=' + Sub,
              success: function(data) {
                  alert(data);
              },
              error: function(data) {
                  alert("ERRRR");
              }
  
          })
      });
  });
  </code></pre>
  
  <p>and this is my PHP code , </p>
  
  <pre><code>     $Sub  = $_POST['Subject'];
       print_r($Sub);
  </code></pre>
  
  <p>It actually sending the value but I don't get any response. I am stucking with it any help will be really appreciated . </p>
  
  <p><strong>EDIT :</strong> </p>
  
  <p>I have heared map or each function can do this but I dont know how to use the functions</p>