Last active
April 30, 2019 17:01
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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