Pass Javascript Variable to grails RemoteFunction

Possible duplicate:
pass parameter to g: remoteLink as a result of javascript function

I am trying to call the remoteFunction call, which is triggered by the onclick button for the button, but the click does not call the function. I checked the onlick command with a warning and called the function. here is my code.

<input type="button" onclick="exportList()" value= "Export"/>

function exportList(){

            var profile= document.getElementById('dropdown').value
            ${remoteFunction(controller: 'profile' , action:'export', params: "'profile=' + profile")}  


}

When I take out the var parameter and profile, the STILL function is not called ... My controller and action are correctly named, so I do not know why I have such an error. Thanks in advance if you can help!

+5
source share
2 answers

JoeCortopassi - grails ${remoteFunction...} javascript. Jquery :

function exportList() {
    var profileToUse = document.getElementById('dropdown').value
    jQuery.ajax({
        url: "/youApp/profile/export",
        type: "POST",
        data: {profile: profileToUse}
    });
}
+3

, ,

${remoteFunction(controller: 'profile' , action:'export', params: "'profile=' + profile")} 

, var{remoteFunction()}? $ - . , jQuery. , , remoteFunction(), , , {}

+2

All Articles