$(".uk-text-large").text("some-text");
$.ajax({
url: 'inc/ajax-view.php',
method: 'GET',
dataType : "json",
data: {
view_2:$(self).data("id")
},
success: function(data) {
console.log(data);
$(".uk-text-large").text(data.view_2); // или $(".uk-text-large").html(data.view_2);
}
});
return false;
$article= Article::orderBy('id', 'desc')->paginate(2);
$arr = $article->toArray();
$arr['user'] = $post->user->toArray();
columnNode = document.createElement('div');
columnNode.classList.add('col-md-4', 'col-sm-4', 'col-xs-4', 'photogallery__column');
let aNode = document.createElement('a');
aNode.classList.add('photogallery__link');
let num = obj.data[3 * i + j]['id'];
aNode.setAttribute('href', '/photogallery/show/' + num);
let imgNode = document.createElement('img');
imgNode.src = '/thumbs/' + obj.data[3 * i + j]['name'];
imgNode.setAttribute('alt', obj.data[3 * i + j]['name']);
aNode.appendChild(imgNode);
columnNode.appendChild(aNode);
rowNode.appendChild(columnNode);
public function index(Request $request)
{
$photos = Photo::orderBy('id', 'desc')->paginate(2);
if ($request->ajax()) {
return $photos->toJson();
} else {
return view('photogallery.home', ['photos' => $photos->toArray()]);
}
}