I am using php while loop and want to get value for ajax. my code is
while{
<form class="commentform">
<input type="hidden" class="proid" name="proid[]" value="<?=$rr['id']?>">
<input type="text" class="form-control wac" name="comval[]" placeholder="Write a comment..">
</form>
}
<script type="text/javascript">
$(document).ready(function(){
$('.commentform').on('submit', function(e){
var comment = $(this).next('.proid').attr('value');
$('#res').html(comment);
alert(comment);
return false;
<script>
please guide to get value in while loop for ajax on form submit. Thanks in advance