Note that there are some explanatory texts on larger screens.

plurals
  1. POjquery within ajax page
    text
    copied!<p>I have been reading around and know that by default jQuery within a the returned html by default does work, but also read that setting the dataType in the ajax requet to "html" shoudl evaluate the jQuery, however it doesn't seem to be doing that. </p> <pre><code>&lt;script type="text/javascript"&gt; $(document).ready(function(){ $('.calendarsubmit').remove(); $('select[name=typetest]').change(function(){ var url = '/&lt;?=$eventurlstart?&gt;/'+escape(this.options[this.selectedIndex].value)+'/&lt;?=$mnth?&gt;/&lt;?=$yr?&gt;'; location.href=url; }); $('select[name=month]').change(function(){ var url = '/&lt;?=$eventurlstart?&gt;/&lt;?=$type?&gt;/'+escape(this.options[this.selectedIndex].value)+'/&lt;?=$yr?&gt;'; location.href=url; }); $('select[name=year]').change(function(){ var url = '/&lt;?=$eventurlstart?&gt;/&lt;?=$type?&gt;/&lt;?=$mnth?&gt;/'+escape(this.options[this.selectedIndex].value); location.href=url; }); }); &lt;/script&gt; </code></pre> <p>That is the code that is loaded with the HTML from the page. How do I execute this? </p> <p>Thanks.</p> <p>EDIT:</p> <p>Using live change seems to work:</p> <pre><code>$('select[name=typetest]').live('change',function(){ </code></pre> <p>The issue I am having now is the .remove(). With or without document ready, it doesn't get called through Ajax.</p> <p>EDIT 2:</p> <p>Although the live works, more ajax following, I need a way to update that live function each time the page is called. </p> <p>EDIT 3:</p> <p>I just called unbind before recreating the live function, which works great. As for the remove function, I had to add it to the end of my page. Even though it was right after the element, it seemed to get called too soon, so the element wasn't removed. Moving it down made it get removed perfectly.</p> <p>Thanks everyone that helped get me to this solution.</p> <p>EDIT 4:</p> <p>This actually didn't work. Not sure what happened. Anyways, what I ended up doing is using the live function and having it read the other forms values in jQuery rather than do it via PHP. Still working on the remove issue. </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