Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>No <code>domready</code> will fire a second time for you as per listings.js, your DOM is already ready. </p> <p>You could manually do <code>window.removeEvents('domready')</code> beforehand, then load via XHR and do <code>window.fireEvent('domready')</code> to run it.</p> <p>If you use event delegation you can avoid having to run any js after initial ajax requests, all you'd need is something like this. </p> <pre><code>window.addEvent('domready', function () { var ct = document.id('cat_table'), divs = ct.getChildren('div'), //need a more qualified selector rtMain = document.id('rt-main'); divs.each(function(el, i){ // store the index, if you don't have it as an attribute like id, rel or data-id el.store('index', i); }); ct.addEvent('click:relay(div)', function(e){ // needs more qualified also. e &amp;&amp; e.stop(); new Request({ method: 'get', // not post, check - faster url: 'blah.php?cat=' + this.retrieve('index'), evalResponse: true, onComplete: function(){ rtMain.set('html', this.response.text); } }).send(); }); // delegation, assumes .itemBox are children of rtMain - just delegate to other parent otherwise. rtMain.addEvent('click:relay(.itemBox)', function(e){ // reliance on index in collection is bad, try to change response above to contain data-id. e.stop(); new Request({ method: 'get', url: 'blah.php?id=' + this.get('data-id'), onComplete: function(){ rtMain.set('html', this.response.text); } }).send(); }); }); </code></pre> <p>keep in mind you had a reliance on the index of the item in the Elements collection, which is less than safe. use a hard db id, provided by the backend. this is insecure, ppl can mod their DOM, delete elements and get to ids they should not see. Not that they can't do so otherwise but... </p> <p>Bringing in scripts via XHR and evaling responses is an anti-pattern and gives a vector of attack on your page for XSS, don't forget that. </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.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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