title: Updated value of form item fetched with ajax
body: <p>I am working in wordpress and I am using an ajax call to return aid field. I have a form in for loop and there are multiple submit buttons. I want the updated value of aidd field returned. aidd always return the first clicked value</p>
  
  <pre><code>jQuery(function ($) {
          $(document).on("click",".star", function(e) {
          e.preventDefault();
  
          var aid = jQuery("#aid").val();
  
  
          //////////////////////////////////
         alert(aidd);
               var sentdata =({
  
                  action: 'star',
                      id:aid
              })
      var element = $(this);
       $.post(yes.ajaxurl, sentdata, function (res) { //start of funciton
      alert(id);
                  $(element).siblings("#hero").html(res);
              } //end of function
              ,
              'json');    }); //end inner function
      });
  </code></pre>
  
  <p>php (just pasting the form php code )</p>
  
  <pre><code>$form.= '&lt;form id="voteform" action="" method="post"&gt;';
      $form.='&lt;div&gt;';
  
      $form.= "&lt;input id='aid' name='aid' type='text' value='$result-&gt;aid'&gt;";
       ///////////////
      $form.="&lt;input class='star' id='star1' type='image' type='submit' name='star5' src='http://localhost:8080/test/wp-content/uploads/2015/05/star0.png' value='1' style='border:0px!important;'&gt;";
      $form.="&lt;input class='star' id='star2' type='image' type='submit' name='star5' src='http://localhost:8080/test/wp-content/uploads/2015/05/star0.png' value='2' style='border:0px!important;'&gt;";
      $form.="&lt;input class='star' id='star3' type='image' type='submit' name='star5' src='http://localhost:8080/test/wp-content/uploads/2015/05/star0.png' value='3' style='border:0px!important;'&gt;";
      $form.="&lt;input class='star' id='star4' type='image' type='submit' name='star5' src='http://localhost:8080/test/wp-content/uploads/2015/05/star0.png' value='4' style='border:0px!important;'&gt;";
      $form.="&lt;input class='star' class='star' id='star5'  type='image' type='submit'  name='star5' src='http://localhost:8080/test/wp-content/uploads/2015/05/star0.png' value='5' style='border:0px!important;'&gt;";
  
      $form.='&lt;input class="star" name="star5" src="http://localhost:8080/test/wp-content/uploads/2015/05/star0.png" type="image" type="submit" value="6" /&gt;&lt;/form&gt;';
  </code></pre>
  
  <p>Resulting php function</p>
  
  <pre><code>add_action( 'wp_ajax_star', 'star' );
  add_action( 'wp_ajax_nopriv_star', 'star');
  
  
  function star()
  {
  
  
      $aid = $_POST['id'];
      echo json_encode ($aid);
      die();
  }
  </code></pre>