Search code examples
ajaxgrailsgsp

username availability checking using ajax in GRAILS


I am doing one web application in grails.Now I am making signup page.In signup page I want to check the username availability via ajax.I can write the code for username availability checking in controller or service.I struck with how to contact server from client side via ajax.

My sample gsp code is

<g:form method="post" action="signup" controller="auth">
 <input type="text" name="name" >
 <input type="text" name="username" >
 <input type="password" name="password" >
 <input type="submit" value="signup">
 </g:form>

In the above code if the username textbox lost the focus it should check for availabity.I did a bit of google search.But i couldn't get what i want.Can anyone provide help or good tutorial for this?

Thanks.


Solution

  • By using remoteFunction method we can do that.