0

ソース コードをjQuery オートコンプリート デモからコピーし、相対 URL を絶対 URL に置き換えますが、localhost でページをテストすると、オートコンプリート ウィジェットが機能しません。誰でも私を助けることができますか?

<html lang="en">

    <head>
        <meta charset="utf-8" />
        <title>jQuery UI Autocomplete - Remote with caching</title>
        <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.1/themes/base/jquery-ui.css" />
        <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
        <script src="http://code.jquery.com/ui/1.10.1/jquery-ui.js"></script>
        <link rel="stylesheet" href="http://jqueryui.com/resources/demos/style.css" />
        <style>
            .ui-autocomplete-loading {
                background: white url('http://jqueryui.com/resources/demos/autocomplete/images/ui-anim_basic_16x16.gif') right center no-repeat;
            }
        </style>
        <script>
            $(function () {
                $("#birds").autocomplete({
                    source: "http://jqueryui.com/resources/demos/autocomplete/search.php",
                    minLength: 2
                });
            });
        </script>
    </head>

    <body>
        <div class="ui-widget">
            <label for="birds">Birds:</label>
            <input id="birds" />
        </div>
    </body>

</html>
4

1 に答える 1

2

他のホストにリクエストを送信することはできません。localhostはjqueryui.comと同じではないため、同一生成元ポリシーによってブロックされています

于 2013-02-28T03:12:59.753 に答える