Everything works fine, except when I click "thums up" button, it always update my first row in table.
My code is on github, so you can see it there, and here is just excerpt
https://github.com/sasafister/scheduler/blob/materialdesign/resources/views/titles/index.blade.php
var url = "{{ url("/") }}" + "/{{ Auth::user()->id }}" + "/titles"
$("#upVote i").on("click", function() {
$.ajax({
type: 'POST',
url: url + "/upvote" + "/" + this.id,
success: function(data) {
$('#numVote').html(data);
}
});
});
Here is DOM
@foreach ($titles as $title)
@if($title->created_at > \Carbon\Carbon::today())
<tr id="votes">
<td>{{ \Carbon\Carbon::parse($title->time)->format('d.m.') }}</td>
{{--<td id="id">{{ $title->id}}</td>--}}
<td>{{ $title->user->name }}</td>
<td>{{ $title->title }}</td>
<td id="downVote"><i id="{{ $title->id }}" class="tiny material-icons red-text">thumb_down</i></td>
<td id="numVote">{{ $title->votes }}</td>
<td id="upVote"><i id="{{ $title->id }}" class="tiny material-icons green-text">thumb_up</i></td>
<td>{!! link_to_action('TitlesController@show', 'Edit', [$customer, $title->id]) !!}</td>
</tr>
@elseif($title->created_at < \Carbon\Carbon::today())
<tr class="grey-text">
<td>{{ \Carbon\Carbon::parse($title->time)->format('d.m.') }}</td>
<td>{{ $title->user->name }}</td>
<td>{{ $title->title }}</td>
<td></td>
</tr>
@endif
@endforeach