Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery script not working with Ajax
    primarykey
    data
    text
    <p>I have an issue:</p> <p>I am implementing jQuery scroll bar (<a href="http://tympanus.net/codrops/2011/09/30/scrollbar-visibility-with-jscrollpane/" rel="nofollow">from here</a>) on my content list that are populating through Ajax. I have two pages. On the first page <strong>js/custom_scrollbar.js</strong> have main "jp-container" function.</p> <p>First Page:</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;link rel="stylesheet" type="text/css" href="css/style.css" /&gt; &lt;link rel="stylesheet" type="text/css" href="css/jquery.jscrollpane.codrops2.css" /&gt; &lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"&gt;&lt;/script&gt; &lt;!-- the mousewheel plugin --&gt; &lt;script type="text/javascript" src="js/jquery.mousewheel.js"&gt;&lt;/script&gt; &lt;!-- the jScrollPane script --&gt; &lt;script type="text/javascript" src="js/jquery.jscrollpane.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="js/scroll-startstop.events.jquery.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="js/custom_scrollbar.js"&gt;&lt;/script&gt; &lt;/head&gt; &lt;body onload='myContactList();'&gt; &lt;div id="contentListDiv" class="list jp-container"&gt;&lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>Second Page: </p> <pre><code>&lt;ul&gt; &lt;li&gt; &lt;a href="#"&gt;Z&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt; </code></pre> <p>When i receive Ajax response, it populates <code>&lt;li&gt;</code> list and merge contents in <code>&lt;div&gt;</code> on the first page through .innerHTML. I'm simply calling a part of another page and merging its contents into the main page. Following function is getting Ajax response.</p> <pre><code>function myContentList() { var http = createRequestObject(); http.open('GET', 'myContentListURL'); document.getElementById("contactListDiv").innerHTML = '&lt;img src="images/loader-small.gif" border="0" /&gt;'; http.onreadystatechange = function() { if (http.readyState == 4 &amp;&amp; http.status == 200) { if (http.getResponseHeader("SessionExpired") == "true") window.location = "SessionExpiredURL"; var response = http.responseText; if (response) { document.getElementById("contactListDiv").innerHTML = response; eval(document.getElementById('contactsDivScript').innerHTML); } } }; http.send(null); } </code></pre> <p>When I place <code>&lt;ul&gt;</code> on first page without calling Ajax or .innerHTML - jQuery works as expected and it displays jQuery scroll bar on contents. But if i follow above code it doesn't call jQuery script.</p> <p>Thank You!</p>
    singulars
    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.
 

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