日期:2014-05-16  浏览次数:20402 次

js声明全局对象
var area = [];
var Areautil = {
    getArea: function(){
        if(area.length > 0) {
            return area;
        } else {
            $.ajax({
                type: 'get',
                url:  'example.action',
                data: {'id':Math.random()},
                async: false,
                beforeSend: function(){},
                success: function(data){
                    area = data.area;
                }
            });
            return area;
        }
    }
}