jQTouch execute code when AJAX page is loaded

◇◆丶佛笑我妖孽 提交于 2019-12-20 03:57:05

问题


When the content is static:

<a href="#nearme">Click</a>
<script>$('#nearme').bind('pageAnimationEnd', function(event, info){});</script>

When the content is AJAX:

<a href="page.html">Click</a>

How do I bind something to occur after the AJAX (page.html) is loaded?


回答1:


This question pertains to jqtouch which makes AJAX requests from regular anchor tags




回答2:


Take a look at the demo, in particular the "GET Example" under AJAX section. Essentially, you want to have the anchor element to link to a page which returns a "jQTouch page", i.e. <div id="pageID">...</div>.

So, in your case, you may have this anchor:

<a href="page.html" class="slide">Click</a>

And the page.html may be something like:

<div id="ajaxPage">
  <div class="toolbar"><h1>Title</h1></div>
  <div>
    <ul>
      <li>item 1</li>
      <li>item 1</li>
    </ul>
  </div>
</div>


来源:https://stackoverflow.com/questions/3603236/jqtouch-execute-code-when-ajax-page-is-loaded

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!