Note that there are some explanatory texts on larger screens.

plurals
  1. POCant get Isotope to work with AJAX (code samples)
    primarykey
    data
    text
    <p>I am trying to integrate isotope but Iam having problems getting it to work with ajax.</p> <p>Here's the code:</p> <pre><code>&lt;script type="text/javascript"&gt; var currentPage = 1; $(function(){ var getUrl = 'loadMovies.php'; var getQuery = 'genrefilter='+movieSelection.elements["genreFilter"].value; getQuery += '&amp;yearfilter='+movieSelection.elements["yearFilter"].value; getQuery += '&amp;titlesort='+movieSelection.elements["titleSort"].value; getQuery += '&amp;ratingsort='+movieSelection.elements["ratingSort"].value; getQuery += '&amp;yearsort='+movieSelection.elements["yearSort"].value; getQuery += '&amp;runtimesort='+movieSelection.elements["runtimeSort"].value; getQuery += '&amp;currentPage='+currentPage; var $container = $('#movieBox'); //$container.isotope({itemSelector: '.movie'}); $.ajaxSetup({cache:false}); var ajax_load = "&lt;img class='loading' src='images/load.gif' alt='loading...' /&gt;"; //$("#genreFilter").change(function(){$container.isotope('insert', ajax_load).load(getUrl, getQuery);}); $("#genreFilter").change(function(){$('#movieBox').html(ajax_load).load(getUrl, getQuery);}); }); </code></pre> <p></p> <p>HTML is just ""</p> <p>With the isotope line commented out I actually get divs displayed as expected but since I cant figure out how to work in the isotope line I cant get it to work.</p> <p>I am trying to integrate isotope with "insert" method which I got to work without ajax.</p> <p>Extract from: <a href="http://isotope.metafizzy.co/docs/adding-items.html" rel="noreferrer">http://isotope.metafizzy.co/docs/adding-items.html</a></p> <hr> <p>"insert method</p> <p>More likely, you want to use the insert method, which does everything that addItems misses. insert will append the content to the container, filter the new content, sort all the content, then trigger a reLayout so all item elements are properly laid out.</p> <pre><code>var $newItems = $('&lt;div class="item" /&gt;&lt;div class="item" /&gt;&lt;div class="item" /&gt;'); $('#container').isotope( 'insert', $newItems ); </code></pre> <hr> <p>Last line is what I need to integrate with the ajax line but I just don't see where I could place it. Ive tried few methods one of which is shown in the commented out line.</p> <p>Can anyone see the problem?</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