Could someone please help me out.
How can i put this foreach statement in json_encode for example.
<?php foreach ($movies as $movie) { ?>
<div>
<h3><?php echo $movie['title']; ?><h3>
<img src="/somewhere/<?php echo movie['image']; ?>" />
</div>
<?php } ?>
So what i want to do is pass all movies from the foreach to json function So i can pass it to ajax
$.ajax({
type: "GET",
url: path+'/ajax/somefile.php',
dataType: 'json',
data: {page: requestTime},
success: function(response) {
var data = $.parseJSON(response.data);
var $row = $('<div></div>', { 'class': 'row', style: 'display: none;' }).html(data.join(''));
$row.appendTo('#movie-rating-grid').fadeIn();
}
});
Could someone explain or show how to do this thanks
div, you don't really need json.