JQTOUCH, Binding to links pulled in via AJAX, to make another AJAX call? Possible?
Posted
by nobosh
on Stack Overflow
See other posts from Stack Overflow
or by nobosh
Published on 2010-04-09T04:50:45Z
Indexed on
2010/04/09
4:53 UTC
Read the original article
Hit count: 655
Hello. I'm using JQTOUCH using the AJAX example provided in the demo:
$('#customers').bind('pageAnimationEnd', function(e, info){
if (!$(this).data('loaded')) { // Make sure the data hasn't already been loaded (we'll set 'loaded' to true a couple lines further down)
$('.loadingscreen').css({'display':'block'});
$(this).append($('<div> </div>'). // Append a placeholder in case the remote HTML takes its sweet time making it back
load('/mobile/ajax/customers/ .info', function() { // Overwrite the "Loading" placeholder text with the remote HTML
$(this).parent().data('loaded', true); // Set the 'loaded' var to true so we know not to re-load the HTML next time the #callback div animation ends
$('.loadingscreen').css({'display':'none'});
}));
}
});
This then returns a nice UL which outputs just fine..
<ul class="edgetoedge">
<li class="viewaction" id="715">
<span class="Title"><a href="/c-view/715/">Lorem Ipsum is simply dummy text of the...</a></span>
<div class="meta">
<span class="dateAdded"> 1d ago </span>
</div>
</li>
</ul>
This is where I get stuck. How can I then make it so when you click on the link above, it loads the URL wrapped near the class="Title" ?
I'd like it to load JQTouch like the first code example.
I tried the following two things without success:
$('.viewaction').bind('click', function() {
alert('wow');
});
$('.viewaction').live('pageAnimationEnd', function(e, info){
});
Thank you!
© Stack Overflow or respective owner