如何在 Dashcode 使用 jQuery?

HOWTO use jQuery in Dashcode?

在main.html內需要引入jquery-x.x.x.min.js檔案. 我是把jquery 當按放在 scripts 目錄內.所以main.html程式如下 :

1
<script type="text/javascript" src="scripts/jquery-1.3.2.min.js" charset="utf-8"></script>

然後假設你在front panel裡面有個somebutton的按鈕. 按了一下之後使用 jquery 處理那個事件, 在 main.js 的程式碼如下(寫在檔案最後面) :

1
2
3
4
5
6
7
8
9
$(document).ready(function() {
    $("#somebutton").click(function(){
        $.get("http://www.samtseng.liho.tw/~samtz/blog/",
        function(txt){
            // processing txt;
            // 在這裡處理 jQuery get 回來的結果 (txt).
        });
    });
});

大致上這應就可以在 Dashcode 裡面使用 jQuery. 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *

 

This site uses Akismet to reduce spam. Learn how your comment data is processed.