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

Ext.Ajax.request 实现同步交互
第一步 先把这个ext-basex.js 导入到页面
<link rel="stylesheet" href="js/ext/resources/css/ext-all.css">
<script type="text/javascript" src="js/ext/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="js/ext-basex.js"></script>
<script type="text/javascript" src="js/ext/ext-all.js"></script>

Ext.Ajax.request({
url:"/timesheet/servlet/Main",
method:'POST',
async: false,               params:{ },
success:function(response,option){
var objstr = response.responseText;
if(objstr!=""){
var objs = Ext.util.JSON.decode(response.responseText);
if (objs.length > 0)
                  {
                     alert(objs.length);
                  }else{
                     alert('json length is 0');
                  }
}
});