views:

938

answers:

2

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!

+1  A: 

Put this one somewhere outside your first bind function

$("span[class=Title]").delegate("a", "click", function(){
    alert('LOLCAT');
});
Ivo Sabev
Thanks Ivo, how do I get it to slide in JQTOUCH web app style like? Are you familar with JQTOUCH? thxs!
AnApprentice
I think this is the answer of your prayers - http://www.youtube.com/watch?v=4dIAalPwDq0
Ivo Sabev
That's close and very very cool. But with that when you click the back btn on the 3rd page it takes you back to the first page, not page 2. Ideas?
AnApprentice
<a href="#" class="back"> will go automatically to the previous page.
Ivo Sabev
A: 

hello, I have the same question. Tried the Answer but can't make it work. When I click a hyperlink generated from the Ajax call, it throws me to the target page of the hyperlink (ie, leave jqtouch)...Any clue?

Thanks in adv :)