Skip to content

Instantly share code, notes, and snippets.

@Joxebus
Last active April 30, 2019 17:01
Show Gist options
  • Save Joxebus/3c1894e4e0ec94a0014c5d6a95eff947 to your computer and use it in GitHub Desktop.
Save Joxebus/3c1894e4e0ec94a0014c5d6a95eff947 to your computer and use it in GitHub Desktop.
This is an example of how to define an ajax call with Grails 3
<script type="text/javascript">
$(document).ready(function(){
$("#yourId").change(function () {
$.ajax({
url: "${g.createLink(controller:'yourContrller',action:'yourAjaxAction')}",
dataType: 'json',
data: {},
success: function (data) {
alert(data)
},
error: function (request, status, error) {
alert(error)
},
complete: function () {
}
});
});
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment