2
在我的grails模板中,我調用remoteFunction(使用jquery庫)onload。爲了測試它是否有效,我在這個行動中寫了一個println。事實證明,它確實有效,但只有一個打印語句,而不是控制檯中出現的多個打印語句,而不是我的集合中的多個項目。Grails:多個onload ajax調用,但只有一個打印到控制檯
這裏是我的代碼片段
GSP:
<figcaption id="secondcap">
<img id="changer" src="${resource(dir: "images/images", file: "heart.png")}" onload="${remoteFunction(controller:'user', action: 'hasHearted')}" alt="heart">
</figcaption>
常規:
def hasHearted = {
println "Recieved user ID:"
}