favorite-vacancy-45.blade.php
1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<script>
$(document).ready(function() {
$(document).on('click', '.js_vac_favorite', function () {
var _this = $(this);
var id = _this.attr('id');
var id_vacancy = _this.attr('data-val');
if ($( "#"+id ).hasClass( "active" )) {
$.ajax({
type: "GET",
url: "{{ route('like-vacancy') }}",
data: "code_record=" + id_vacancy,
success: function (data) {
///
},
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
},
error: function (data) {
data = JSON.stringify(data);
console.log('Error: ' + data);
}
});
} else {
$.ajax({
type: "GET",
url: "{{ route('like-vacancy') }}",
data: "code_record=" + id_vacancy + "&delete=1",
success: function (data) {
///
},
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
},
error: function (data) {
data = JSON.stringify(data);
console.log('Error: ' + data);
}
});
}
});
});
</script>