0
我想寫一個函數在JavaScript中接收兩個參數(目標,內容)使用$ .load()jquery函數加載ajax的內容,代碼如上:定製函數來加載內容使用jquery ajax
function cargarContenido(content,target) {
$(target).load(content);
}
我把這樣的功能,這是行不通的:
<a href="#" onclick="cargarContenido('hd.html','content')">
謝謝!
謝謝!還有一件事,在相同的代碼中,當我點擊鏈接時,如何防止默認行爲? – webingeniuz 2012-07-20 18:34:10
只需添加'return false;'作爲您最後一次調用方法。 – scottm 2012-07-20 18:35:45
It Works!我錯了!謝謝! – webingeniuz 2012-07-20 18:47:22