Initializing links in jqtouch in AJAX loaded content
- by Cody Caughlan
I have an iphone web app built in jqtouch, when content is loaded by links ("a" tags) then any content on the next page is parsed by jqtouch and any links are initialized. However, when I load content via an AJAX call and append() it to an element then any links in that content are NOT initialized by jqtouch. Thus any clicks on those links are full-blown clicks to a new resource and are not handled by jqtouch, so at that point you've effectively broken out of jqtouch.
My AJAX code is:
#data
<script type="text/javascript">
$.ajax({
url: '/mobile/nearby-accounts',
type: 'GET',
dataType: 'html',
data: {lat: lat, lng: lng},
success: function(html) {
$('#data').empty().append(html);
// Is there some method I call on jqtouch to have any links in $('#data') be hooked up to the jqtouch lifecycle?
}
</script>
Thanks in advance.