1

この問題を解決するために、グーグルで検索された大量のページを閲覧しましたが、それぞれがユニークであるように見えます. 私のページのソースは、パックが機能するようにバンドルされていることを示しています

 <script src="/Content/js?v=N2f3Y-Z24wBpC67A34qPxjK1CR3eY83Yijs13VtHOwI1"></script>

、しかし、ブラウザ(クロム)開発ツールは、ロードに失敗したことを示しています:

Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:53608/Content/js/

また、スクリプトの src リンクをクリックすると、リソースが見つからないか見つからないという Microsoft 生成のメッセージも表示されます。

他のバンドル (スタイル) をロードしても問題ありませんが、コード レイアウトに何かが欠けていて、自分で問題を見つけることができません。誰かが私の間違いを指摘してくれたら本当にありがたいので、コードを次に示します。

_Layout.cshtml

    @Styles.Render("~/Content/css")
    @Scripts.Render("~/Content/js")
    @Scripts.Render("~/bundles/jquery")

BundleConfig.cs

            bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
                    "~/Scripts/jquery-1.9.1.js",//(tried other numbers as well)
                    "~/Scripts/jquery-ui-1.10.4.js",
                    "~/Scripts/jquery.unobtrusive*",
                    "~/Scripts/jquery.validate*",
                    "~/Scripts/modernizr-*",
                    "~/Scripts/itpoverlay.js"
                    ));

        bundles.Add(new StyleBundle("~/Content/css").
            Include("~/Content/bootstrap.css",
            //"~/Content/ie.css",
            "~/Content/kwicks-slider.css",
            "~/Content/style.css",
            "~/Content/custom.css",
            "~/Content/responsive.css",
            "~/Content/touchTouch.css"));

        bundles.Add(new ScriptBundle("~/Content/js").Include(
          "~/Content/js/bootstrap.js",
          "~/Content/js/forms.js",
          "~/Content/js/jquery.easing.1.3.js",
          "~/Content/js/jquery.flexslider-min.js",
          "~/Content/js/jquery.kwicks-1.5.1.js",
          "~/Content/js/jquery.preloader.js",
          "~/Content/js/superfish.js",
          "~/Content/js/jquery.js",//(default bundle v1.8.1)
          "~/Content/js/touchTouch.jquery.js"));
       BundleTable.EnableOptimizations = true;

_references.js (文字通り、そこにある理由がわかりません)

/// <reference path="jquery-1.9.1.js" />
/// <reference path="jquery-ui-1.10.4.js" />
/// <reference path="jquery.unobtrusive-ajax.js" />
/// <reference path="jquery.validate.js" />
/// <reference path="jquery.validate.unobtrusive.js" />
/// <reference path="knockout-2.1.0.debug.js" />
/// <reference path="modernizr-2.5.3.js" />

出力については、バンドルが適切に生成されているように見えます。

    <link href="/Content/css?v=NASaW-JeM0CkSMQIcoasDpn9k7bKaEK07c7WakA1Y0k1" rel="stylesheet"/>
    <script src="/Content/js?v=N2f3Y-Z24wBpC67A34qPxjK1CR3eY83Yijs13VtHOwI1"></script>
    <script src="/bundles/jquery?v=VwkJeyosUZnIv9pTtkEir1OOQCcR7BXo1RW8kdleacU1"></script>

そして、開発ツールはエラーのリストをマークします (私は、_reference.js が何に使用される可能性があるかを理解し始めていると思います) それもバンドルする必要がありますか? エラー:

Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:53608/Content/js/
Uncaught TypeError: Object [object Object] has no method 'live' jquery?v=VwkJeyosUZnIv9pTtkEir1OOQCcR7BXo1RW8kdleacU1:1
Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:53608/js/jquery.preloader.js

私の間違いを見つけるのに十分であることを願っています。不明な点がある場合は、必要な情報で喜んで質問を更新します。ありがとう、アーニス。

4

1 に答える 1

0

Jquery live メソッドは 1.7 で非推奨になり、1.9 を使用しているようです

https://api.jquery.com/live/

したがって、2 つのオプションがあるように見えます。live メソッドを使用している場所を把握し、.on() を使用するように変更します。.live() の使用方法がわからないため、特定のコードを提供することはできません

またはjquery migrateの使用を検討してください

http://blog.jquery.com/2013/05/08/jquery-migrate-1-2-1-released/
于 2014-04-08T15:04:25.010 に答える