I need to send variables at runtime to a js method for ajax. I am trying with this onclick function but it gives syntax error on click.:
Spaces in your JavaScript code are most likely a syntax error. If your values have spaces, it's best to treat them as strings.
onclick="sendAjax('${abc.firstVal}', '${abc.secVal}', ... '${abc.fifthVal}')">
If you want to use them as numbers later, you can use the JavaScript functions parseInt
and parseFloat
to turn strings into numbers.
Did you try leaving a space after the last curly brace?