Hi, I have a page that has some images in groups of 1, 2 or 3. The image paths are retrievd from a mysql table. You click on one image and the whole group gets shown in another div. This works fine, I want to show the images using the galleria plugin, which doesnt seem to work. It works ok when I hardcode some images into the div, but with the ajax populate stuff it just acts as if galleria is not there!

Here are the files.

projects.js

// whenever a link with category class is clicked
$('a.project').click(function(e) {
    // first stop the link to go anywhere
    e.preventDefault();
    // you can get the text of the link by converting the clicked object to string
    // you something like 'http://mysite/categories/1'
    // there might be other methods to read the link value
    var linkText = new String(this);
    // the value after the last / is the category ID
    var projectvalue = linkText.substring(linkText.lastIndexOf('/') + 1);
    // send the category ID to the showprojects.php script using jquery ajax post method
    // send along a category ID
    // on success insert the returned text into the product-data div
    $.post('../inc/showprojects.php', {project: projectvalue}, function(data) {
        $('#shownews').html(data);
    });
});

showprojects.php

<?php
include 'connect.php';

// if no project was sent, display some error message
if(!isset($_POST['project'])) {
    die('No project has been chosen');
}
// cast the project to integer (just a little bit of basic security)
$project = (int) $_POST['project'];
// this will be the string that you will return into the shownews div
$returnHtml = '';
$q = "SELECT * FROM projects WHERE id='$project'";
if($r = mysql_query($q)) {
    // construct the html to return
    while($row = mysql_fetch_array($r)) {
        $returnHtml .= "<img src='{$row['filename']}' />";
        $returnHtml .= "<img src='{$row['filename1']}' />";
        $returnHtml .= "<img src='{$row['filename2']}' />";
    }
}
// display the html (you actually return it this way)
echo $returnHtml;
?>

Can anyone help?

Thanks for looking...................

Anyone? I'm no further with this!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.