2015-02-08 120 views
-4

如何將客戶端jQuery支持添加到程序中?我想 開始在我的web應用程序中使用jQuery,但在執行此操作之前,我需要添加代碼以將jQuery包含在我的應用程序中。添加客戶端jQuery支持

我需要添加哪些代碼到應用程序?

我與文件以下目錄:

路線/ index.js

的意見/ layout.jade

的意見/ index.jade

的意見/筆記。玉

views/edit.jade

的意見/ updated.jade

斌/ WWW

回答

0

您可以在layout.jade與Google Loader它包含:

<script src="https://www.google.com/jsapi"></script> 
<script> 
     google.load("jquery", "2.1"); 
     google.load("jqueryui", "1.11"); 
     google.setOnLoadCallback(function() { 
       //... your Code here 
     } 
</script> 
0

與這一個

script(type='text/javascript' src='http://code.jquery.com/jquery.min.js') 
+0

你會怎麼寫嘗試它在玉?我沒有使用HTML語法。我收到一個錯誤,說意外的標識符 – user3055141 2015-02-08 21:17:22

+0

我編輯了我的答案,試試看,並告訴我它是否有效。 – 2015-02-10 11:21:28