vendredi 7 mai 2021

How to invoke a controller method from my Javascript?

I have a JS function in my erb file as such

....

function sendData(){
  let payload = {'user':'1'};
  //call controller function with payload here
}

.... My controller is like this :

def myMethod(payload)
    @page_title = 'Request an Disti RMA'
    logger.info "****Inside the generate RMA Method"
end

Can someone please tell me how to call the controller method with variables from the JS function?

Aucun commentaire:

Enregistrer un commentaire