2014-01-20 173 views
0

我有這個簡單的JQ購物車,我想添加到我的網站,但它從來沒有工作,所以我做了一個sepreat html文件與購物車和本地測試它,它工作完美。我上傳所有文件到我的websever通過FTP然而它不起作用,但它不工作,J-Query在桌面停止工作停止在線工作

我花了幾個小時尋找可能的錯誤,但沒有運氣,任何人都可以友好地快速查看並告訴我它可能是什麼?

下面

是該指數

<html> 
    <head> 
     <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js" type="text/javascript"></script> 
     <meta charset="utf-8"> 
     <!-- CSS for this product--> 
     <link rel="stylesheet" type="text/css" href="lib/dc.core.1.1.0.min.css" /> 
     <link rel="stylesheet" type="text/css" href="lib/dc.cart.css" /> 
     <!-- CSS for this example only--> 
     <link rel="stylesheet" type="text/css" href="common/sample.common.css" /> 
     <link rel="stylesheet" type="text/css" href="common/sample.product.css" /> 
     <link rel="stylesheet" type="text/css" href="common/prettify.css" /> 
     <!-- Javascript for this product--> 
     <script src="lib/dc.core.1.1.0.min.js" type="text/javascript"></script> 
     <script src="lib/dc.cart.free.min.js" type="text/javascript"></script> 
     <script src="lib/dc.cart.lang.js" type="text/javascript"></script> 
     <!-- CSS for this example only--> 
     <script src="common/prettify.js" type="text/javascript"></script> 
     <script type="text/javascript"> 
      $(function() { 

       // Create a new AJAXPaypalCart Object 
       var cart = $('#cart').DCAJAXPaypalCart({ 
        width: 600, 
        autoOpenWhenAdd: true, 
        openNewCheckOutWindow: true, 
        //themeColor:'#333', 
        //themeDarkColor:'#FFF', 
        header: 'AJAX Cart Demo', 
        footer: 'We accpet paypal, visa and master card. (This is a customizable footer)', 
        paypalOptions: { 
         business: '[email protected]', 
         page_style: 'digicrafts' 
        } 
       }); 

       // Add the button 
       cart.addBuyButton("#macbook", { 
        name: 'MacBook', // Item name appear on the cart 
        thumbnail: 'med/macbook.jpg', // Thumbnail path of the item (Optional) 
        price: '999', // Cost of the item 
        shipping: 20 // Shipping cost for the item (Optional) 
       }); 
       cart.addBuyButton("#macbookair", { 
        name: 'MacBook Air', 
        thumbnail: 'med/macbook.jpg', 
        price: '999', 
        shipping: 20 
       }); 
       cart.addBuyButton("#macbookpro", { 
        name: 'MacBook Pro', 
        thumbnail: 'med/macbookpro.jpg', 
        price: '1199', 
        shipping: 0 
       }); 
       cart.addBuyButton("#imac", { 
        name: 'iMac', 
        thumbnail: 'med/macbook.jpg', 
        price: '1199', 
        shipping: 0 
       }); 
       cart.addBuyButton("#macmini", { 
        name: 'Mac Mini', 
        thumbnail: 'med/macbookpro.jpg', 
        price: '699', 
        shipping: 20 
       }); 
       cart.addBuyButton("#macpro", { 
        name: 'Mac pro', 
        thumbnail: 'med/macpro.jpg', 
        price: '2499' 
       }); 
       cart.addBuyButton("#macosx", { 
        name: 'Mac OS X', 
        thumbnail: 'med/macosx.jpg', 
        price: '99', 
        allowMultiple: false 
       }); 

       // For code highlight 
       prettyPrint(); 

      }); 
     </script> 
    </head> 

    <body> 
     <div id="pageWrapper"> 
      <!--End: Common Header --> 
      <div class="product_list"> 
       <div class="product_list_header">Demo Store 
        <div class="sub"></div> 
        <div id="cart">Cart</div> 
       </div> 
       <div id="product_list" class="product_list_content"> 
        <div class="product"> 
         <div class="thumbnail"> 
          <img src="med/macbook.jpg" /> 
         </div> 
         <div class="caption"> 
          <div class="text"> 
           <div class="main">MacBook</div> 
           <div class="sub">(shipping $20)</div> 
          </div> 
          <div class="button" id="macbook">buy $999</div> 
         </div> 
        </div> 
        <div class="product"> 
         <div class="thumbnail"> 
          <img src="med/macbookair.jpg" /> 
         </div> 
         <div class="caption"> 
          <div class="text"> 
           <div class="main">MacBook Air</div> 
           <div class="sub">(shipping $20)</div> 
          </div> 
          <div class="button" id="macbookair">buy $999</div> 
         </div> 
        </div> 
        <div class="product"> 
         <div class="thumbnail"> 
          <img src="med/macbookpro.jpg" /> 
         </div> 
         <div class="caption"> 
          <div class="text"> 
           <div class="main">MacBook Pro</div> 
           <div class="sub">(free shipping)</div> 
          </div> 
          <div class="button" id="macbookpro">buy $1199</div> 
         </div> 
        </div> 
        <div class="product"> 
         <div class="thumbnail"> 
          <img src="med/macosx.jpg" /> 
         </div> 
         <div class="caption"> 
          <div class="text"> 
           <div class="main">Mac OS X</div> 
           <div class="sub">(Purchase once|Download)</div> 
          </div> 
          <div class="button" id="macosx">buy $99</div> 
         </div> 
        </div> 
        <div class="product"> 
         <div class="thumbnail"> 
          <img src="med/imac.jpg" /> 
         </div> 
         <div class="caption"> 
          <div class="text"> 
           <div class="main">iMac</div> 
           <div class="sub">(free shipping)</div> 
          </div> 
          <div class="button" id="imac">buy $1199</div> 
         </div> 
        </div> 
        <div class="product"> 
         <div class="thumbnail"> 
          <img src="med/macmini.jpg" /> 
         </div> 
         <div class="caption"> 
          <div class="text"> 
           <div class="main">Mac Mini</div> 
           <div class="sub">(shipping $20)</div> 
          </div> 
          <div class="button" id="macmini">buy $699</div> 
         </div> 
        </div> 
        <div class="product"> 
         <div class="thumbnail"> 
          <img src="med/macpro.jpg" /> 
         </div> 
         <div class="caption"> 
          <div class="text"> 
           <div class="main">Mac Pro</div> 
           <div class="sub">(free shipping)</div> 
          </div> 
          <div class="button" id="macpro">buy $2499</div> 
         </div> 
        </div> 
       </div> 
      </div> 
     </div> 
    </body> 
</html> 
+2

您在瀏覽器的調試器控制檯中遇到什麼錯誤?此外,我試圖格式化您的代碼,請不要在下次使用太多空格。 – Daedalus

+0

我沒有得到任何錯誤,在線購物車按鈕不起作用http://www.themovieaimless.com/test.php。我將上傳桌面屏幕截圖 – Loading

+0

奇數。我不熟悉你使用的腳本;你可以鏈接它們嗎?(我不是在談論jQuery)另外,你有鏈接到你的網站嗎? – Daedalus

回答

0

也許是從互聯網

{ 腳本SRC =「HTTPS加載服務器阻塞連接加載你正在使用jQuery庫://ajax.googleapis你可以打開你的瀏覽器並檢查控制檯看看是否正確加載jquery庫? in chrome,只需右鍵單擊 - >檢查元素 - >控制檯選項卡或f12 - >控制檯選項卡。

+0

謝謝大家,我把lib放在本地,而不是調用它,它工作。 – Loading