Problem with Vegas js and database

0

I have a problem with the plugin Vegas.js , when calling my images from the database, I can not see them, they do not appear in the plugin, but I do a console.log and I copy the text in the plugin if appear, this is my code:

$.get('ajax/slides.php', function(data) {
   $('#slideMain').vegas({
     slides: [ data ]
   });
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
AJAX file
$slide = new slideManager();
$slide ->showSlideController();

PHP

public function showSlideController()
{
  $answer = slideModel::showSlideModel("slides");
  foreach($answer as $row => $item){
     echo '{ src: "'.$item['path'].'" },'; // Incluso asi no funciona
  }
}

If someone could tell me what I'm doing wrong, I'd really appreciate it

    
asked by Mario A. Claymation 25.01.2018 в 17:47
source

1 answer

0

here is the solution, in case someone else needs it

$.each(slide, function(i, slideData) {
        slides.push( {src: slideData['path']} );

    });
    
answered by 07.09.2018 / 12:23
source