I am trying to write a script to check the availability of the passed username and email address, using ExtJs or JQuery; and Coldfusion 9 as server language. I have written one script but it's not working as intented.
Thanks Vicente
I am trying to write a script to check the availability of the passed username and email address, using ExtJs or JQuery; and Coldfusion 9 as server language. I have written one script but it's not working as intented.
Thanks Vicente
This page has an easy example of checking username validity and availability along witha tutorial and explanation.
Something like this:
<cfcomponent hint="services.userService">
<cffunction name="checkUser" access="remote" returnformat="json" returntype="struct">
<cfargument name="username">
<cfargument name="email">
<cfset var result = { 'usernameExists' = true, 'emailExists' = true }>
<!--- TODO: Check if the UN and Password exist --->
<cfreturn result>
</cffunction>
</cfcomponent>
Then:
<script>
$.getJSON("services/userService.cfc?method=checkUser",
{ username = theUsername, email = theEmail },
function(json) {
if (json.usernameExists) { ... }
if (json.emailExists) { ... }
}
);
</script>