Javascript 在dijit.form.ValidationTextBox上设置约束

Javascript 在dijit.form.ValidationTextBox上设置约束,javascript,dojo,Javascript,Dojo,我正在调用一个函数onblur。。该函数调用ajax,ajax获取字符串 现在我想知道字符串中的值是否可用。。然后文本框变为红色 我的ajax代码是 function ucheck(){ dojo.xhrPost({ // The URL to request url: "ucheck", timeout : 3000 ,

我正在调用一个函数onblur。。该函数调用ajax,ajax获取字符串

现在我想知道字符串中的值是否可用。。然后文本框变为红色

我的ajax代码是

function ucheck(){
                dojo.xhrPost({
                    // The URL to request
                    url: "ucheck",
                    timeout :  3000 ,
                    content: {
                    username: dojo.byId("pref_id").value

                    },
                    // The method that handles the request's successful result
                    // Handle the response any way you'd like!
                    load: function(result) {
                        var fi=result;
                        document.getElementById('co').innerHTML=fi // this is print the value in lable


                    }
                });
            }

我不确定您是否尝试了以下示例并相应地更改了代码: