Grails: Multiple onload ajax calls, but only one print to console
===

In my grails template I call the remoteFunction (using jquery library) onload. To test if it worked, I wrote a println in the action. Turns out, it did work, but only one print statement went through instead of multiple print statements appearing in the console for the multiple items in my collection.

Here are my code snippets 

gsp:

    <figcaption id="secondcap">				
				<img id="changer" src="${resource(dir: "images/images", file: "heart.png")}" onload="${remoteFunction(controller:'user', action: 'hasHearted')}" alt="heart">
    </figcaption>

groovy:

    def hasHearted = {
		println "Recieved user ID:" 
    }