Note that there are some explanatory texts on larger screens.

plurals
  1. POJquery manage local script with full ajax site
    text
    copied!<p>Basically my app work like that :</p> <p>Index.php manage call to other pages.</p> <p>Each page contains 2 function onLoad() and onClose() which are redefined in each page</p> <p>Index.php call the pages and execute the onLoad </p> <p>Basically, i preload the page in a hidden div, i execute the predefined $.onLoad function and the i put the loaded content into a visible div</p> <p><strong>My question is only about the onLoad() scope, i want to remove code from the jquery eval seq when i change page, but i need a way to define it in the page.php file without knowing the container</strong></p> <p>The eval/seq is probably the eval queue of jquery, can't found info about that, just obtain with firebug...</p> <p><em>In 2 words, i would like to be able to remove injected dom and script when i change context (pages)</em></p> <p>index.php</p> <pre><code>$.onLoad = function() {} $("#blabla").onChange(function() { $("#data_iframe").load(chaineUrl, {}, function(responseText, textStatus, XMLHttpRequest) { $("#data_iframe").ready(function() { $("#data_div").children().remove(); $.onLoad(); $("#data_iframe").children().hide().appendTo($("#data_div")).show(); $("#data_iframe").children().remove(); $.onLoad = undefined; } }); }); </code></pre> <p>page.php</p> <pre><code>&lt;script&gt; $.onClose = (function(){ $('#container').blablabla(); //alert("test"); }); $.onLoad = (function(){ $('#container').blablabla(); } &lt;/script&gt; </code></pre> <p>The problem is that the jquery EVAL/SEQ keep growing each time a page is opened and there are some side-effect like calling multiple time a function...</p> <p>I guess its a scope problem so can you help me correct my code (i've try with or without the $ but doesn't change anything) just for information</p> <pre><code> &lt;div id="data_div"&gt;&lt;/div&gt; &lt;div id="data_iframe"&gt;&lt;/div&gt; </code></pre> <p>Thanks</p>
 

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