<?php foreach ($list as $item): ?>
<tr>
<td>
<div id="<?php echo $item['id']; ?>">
<input type="text" name="name" id="name"/>
<button type="submit" id="ajax_submit" value="<?php echo $item['id']; ?>">run</button>
</div>
</td>
</tr>
<?php endforeach; ?>
In this php-code I generate html table. When user click on button they activate this JQuery script
<script>
$(document).ready(function(){
$('button').click(function(){
var id = "#" + $("button").val();
$.post("data/js", { name: $("#name").val(),id : id },
function(data){
$(id).html(data);
});
})
});
</script>
But, when I want select non-first button in table, script run function for first. Please help to do all normal.
PS sorry for my english ;-(