开发者

ExtJS/jQuery Script to check username and email availability

开发者 https://www.devze.com 2022-12-21 00:15 出处:网络
I am trying to write a script to ch开发者_运维问答eck the availability of the passed username and email address, using ExtJs or JQuery; and Coldfusion 9 as server language. I have written one script b

I am trying to write a script to ch开发者_运维问答eck 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


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>


This page has an easy example of checking username validity and availability along witha tutorial and explanation.

http://jqueryfordesigners.com/using-ajax-to-validate-forms/

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号