浏览 2300 次
锁定老帖子 主题:DWR中无法触发回调函数
该帖已经被评为新手帖
|
|
---|---|
作者 | 正文 |
发表时间:2008-03-05
<create creator="new" javascript="CategoryManager"> <param name="class" value="com.muddy.web.service.impl.CategoryManagerImpl"/> <include method="getCategoryById"/> </create> <convert match="com.muddy.web.model.Category" converter="bean"></convert> 以下是JSP页面的JS方法: function getCity(){ var obj_Pro = document.getElementById("sel_Pro"); var obj_City = document.getElementById("sel_City"); var obj_County = document.getElementById("sel_County"); var pro_Index = obj_Pro.selectedIndex; var pro_Value = obj_Pro.options[pro_Index].value; alert(pro_Value); if(pro_Value != "" && pro_Value != null){ CategoryManager.getCategoryById(pro_Value,cityReturn); }else{ DWRUtil.removeAllOptions(obj_City); DWRUtil.addOptions(obj_City,{'':'please select'}); DWRUtil.removeAllOptions(obj_County); DWRUtil.addOptions(obj_County,{'':'please select'}); } } // callback math function cityReturn(data){ alert("test"); var obj_City = document.getElementById("sel_City"); DWRUtil.removeAllOptions(obj_City); DWRUtil.addOptions(obj_City,{'':'please select','4':'sasdfsa'}); for(var i=0;i<data.length;i++){ DWRUtil.addOptions(obj_City,{'aaaaas':'aaa'}); } } 请有经验的帮忙解决一下。谢谢! 声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
推荐链接
|
|
返回顶楼 | |
发表时间:2008-03-12
CategoryManager.getCategoryById(pro_Value,function(data) {
cityReturn(data); }); |
|
返回顶楼 | |