3

我正在使用 jQuery Mobile,就像标题所说的那样,由于某种原因,一些链接卡在加载微调器上,并且无法打开下一页。这是代码:

<div data-role="page">
    <div data-role="content">
        <ul data-role="listview" data-theme="c" data-dividertheme="b">
            <li data-role="list-divider">Top News</li>
                <?php
                include_once ('simple_html_dom.php');
                $html = file_get_html('http://www.example.com');
                foreach ($html->find('*.overridable a[class=title]') as $main){
                    echo '<li><a href="news.php?url='.urlencode($main->href).'" data-transition="slidedown">'.$main->plaintext.'</a></li>';
                }
                ?>
                <li data-role="list-divider">Other News</li>
                <?php
                    include_once ('simple_html_dom.php');
                    $html = file_get_html('http://www.example.com');
                    foreach ($html->find('div[class=river-post yui-u] h2 a[href*=example]') as $ret){
                        echo '<li><a href="othernews.php?url='.urlencode($ret->href).'" data-transition="slidedown">'.$ret->plaintext.'</a></li>';
                    }
                ?>
            </ul>
        </div>

如您所见,我将点击的 URL 发送到下一页并解析文章。出于某种原因,一两个链接只是卡在加载微调器上。文章的数据与其他的格式相同,但没有打开。但是当我摆脱 jQuery 并使用纯 HTML 时,一切都会按原样打开。该链接被发送到 URL 并在下一页上被解析。任何想法为什么有些链接会卡住?

更新错误:

Uncaught SyntaxError: Unexpected token < jquery-1.8.2.min.js:2
Uncaught ReferenceError: YChartsQuoteEmbed is not defined
4

1 回答 1

0

终于想通了答案。问题是我在 news.php 和 othernews.php 页面上返回的 HTML,其中一些内容是 Javascript。我需要跳过那个 Javascript,现在页面加载得很好。被解析的 Javascript 代码干扰了 jQuery Mobile 代码。

于 2013-03-10T02:44:46.793 回答