You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Dudu <ed...@yahoo.com.br> on 2006/11/21 19:53:10 UTC

[A bit Off-Topic]... problems with js and dojo syntax.

I'm sorry. I have posted in many js groups, but no answer...

I have a js object, and I need to return de data handled by the ajax
request...see on the green comment

dojo.declare("util", null, {
    evalOnBlur: function(id) {
        eval(dojo.byId(id).attributes['onBlur'].value);
    },
    getNomeComponente: function(expr) {
        return expr.substring(3, 11).toUpperCase();
    },
    getValor: function(expr) {
            var retorno = null;
            var bindArgs = {
            url:        'execexit',
            content : { method : 'execsql',
                        sql : 'select 10 as coisa from
pocaauxi'
                        },
            mimetype:   "text/json",
            error:      function(type, errObj){
                            alert("Erro ao fazer request, tente novamente em
"
                                + "alguns minutos. " + errObj);
                            retorno = 'erro';
                            alert(retorno);
                        },
            load:       function(type, data, evt){
                            retorno = data.colunas;
                            alert(retorno);
                            //I tried return here too
                        }
            };
            var requestObj = dojo.io.bind(bindArgs);
            requestObj.load();
            alert(retorno);
            return retorno; //return always nulll :(
    }
});

This is a class to handle the ajax requests, i need to call this function in
other part of code, and get only the number value returned.

Thanks all.