【问题标题】:JQTOUCH, Binding to links pulled in via AJAX, to make another AJAX call? Possible?JQTOUCH,绑定到通过 AJAX 拉入的链接,进行另一个 AJAX 调用?可能的?
【发布时间】:2023-04-10 19:06:01
【问题描述】:

我正在使用演示中提供的 AJAX 示例使用 JQTOUCH:

$('#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'});
            }));
    }
});

然后返回一个很好的 UL 输出就好了..

<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>

这就是我卡住的地方。那么,当您单击上面的链接时,我该如何做到这一点,它会加载包装在 class="Title" 附近的 URL?

我希望它像第一个代码示例一样加载 JQTouch。

我尝试了以下两件事没有成功:

$('.viewaction').bind('click', function() {
  alert('wow');
});

$('.viewaction').live('pageAnimationEnd', function(e, info){

});

谢谢!

【问题讨论】:

    标签: javascript iphone web-applications ipad jqtouch


    【解决方案1】:

    把这个放在你的第一个绑定函数之外的某个地方

    $("span[class=Title]").delegate("a", "click", function(){
        alert('LOLCAT');
    });
    

    【讨论】:

    • 感谢 Ivo,我如何让它像 JQTOUCH 网络应用一样滑动?你熟悉JQTOUCH吗?谢谢!
    • 我想这就是你祈祷的答案 - youtube.com/watch?v=4dIAalPwDq0
    • 这很接近而且非常酷。但是,当您单击第 3 页上的后退按钮时,它会将您带回到第一页,而不是第 2 页。想法?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-10-27
    • 2011-06-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多