2011-12-19 73 views
0

我試圖將jquery導入codeigniter 2.X而不退出。我把鏈接放到庫中,我在調試器中看到它加載它沒有錯誤,但是,當我使用Docuemtn就緒功能時,它不起作用。有誰能夠幫助我?將Jquery導入codeigniter 2.X

這是代碼:

<html> 
<head> 
    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script> 
    <script type="javascript"> 
     $(document).ready(function() { 
      $("a").click(function() { 
       alert("Hello world!"); 
      }); 
     }); 

    </script> 
    <title>Hardware Deal</title> 
</head> 
<body> 
    <div id='header'> 
     <h1> Hardware deal </h1> 
    </div> 
    <div id='body'> 
     <form action='' method = 'post'> 
      Customer Name:<input type='text' name='Cname' id='CName'/><br> 
      Adress:<input type='text' name='CAddress'/><br> 
      Existing Customer? yes<input type='radio' name='existing' value='yes'> no<input type='radio' name='existing' value='no'><br> 

      Printer Contition: <select name='PCondition'/> 
           <option value=''></option> 
           <option value='New Press'>New Press</option> 
           <option value='Second Hand'>Second Hand</option> 
           </select> 
     </form> 
     <a href="">Link</a> 

    </div> 
</body> 

回答

0

你錯過了從第一個腳本源的http:。將第一個腳本標記更改爲:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script> 

第二個腳本標記的類型錯誤。將第二個腳本更改爲:

<script type="text/javascript"> 
    $(document).ready(function() { 
     $("a").click(function() { 
      alert("Hello world!"); 
     }); 
    }); 
</script>