Note that there are some explanatory texts on larger screens.

plurals
  1. POCan Galleria be used with ajax data?
    primarykey
    data
    text
    <p>I really need some help here! I have a page with images in groups of 1, 2, or 3. I click on an image and the class gets sent to some jquery ajax stuff to get the id(mysql) then this gets sent to a php file to build the html for the images to display on a div in my page. This bit works OK, but I'm trying to use the galleria plugin to show the image that haave been sent, but it just act like galleria is not there! If I hardcode some images in the dive. galleria works as it should!</p> <p>here is my project.js file</p> <pre><code>// 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 shownews div $.post('../inc/showprojects.php', {project: projectvalue}, function(data) { $('#shownews').html(data); }); }); </code></pre> <p>This is my showproducts.php file</p> <pre><code>&lt;?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 .= "&lt;img src='{$row['filename']}' /&gt;"; $returnHtml .= "&lt;img src='{$row['filename1']}' /&gt;"; $returnHtml .= "&lt;img src='{$row['filename2']}' /&gt;"; } } // display the html (you actually return it this way) echo $returnHtml; ?&gt; </code></pre> <p>This is how I'm calling galleria on the div</p> <pre><code>// Load the classic theme Galleria.loadTheme('../galleria/themes/classic/galleria.classic.min.js'); // Initialize Galleria $('#shownews').galleria(); </code></pre> <p>Can anyone help me out?</p> <p>Thanks</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload