{"receiveList":[{"receive_dept_id":"1007873","receive_dept_desc":"区公司领导","guid":"2016112316042622494230","receive_platform_id":"001"},{"receive_dept_id":"1007876","receive_dept_desc":"主任","guid":"2016112316042626240391","receive_platform_id":"001"}]}
$.ajax({
url:"/moduleAuthen/default.do?method=loadAllReceive",
dataType:"json", //返回的数据是json 格式
data:$("#fom1").serialize, //提交id为form1的所有参数
success:function(data){
var json =data.receiveList;
//第一种方式的遍历
for(var index in json){
//其实index 就是个索引
var guid =json[index].guid;
var receive_dept_desc =json[index].receive_dept_desc;
}
//还有一种jquery 方式的遍历,效果其实是一样的,拿到后台返回我们的数据,我们就可以进行各种操作了。
$.each(json,index){
var guid =json[index].guid;
var receive_dept_desc =json[index].receive_dept_desc;
}
}
})
{ "compress":[
#if d_live??>
#-- 参数:int pageNo -->
#assign page = request.getParameter("page")!"null">
#assign page = request.getParameter("page")!"null">
#if page!="null" page!="">
#assign page = page?number>
#else>
#assign page=1>
/#if>
#-- 参数:int pageSize-->
#assign pagesize = request.getParameter("pagesize")!"null">
#if pagesize!="null" pagesize!="">
#assign pagesize = pagesize?number>
#else>
#assign pagesize=10>
/#if>
#if d_live.getLiveInfoList( page,pagesize,"3")??>
#assign pagedContent = d_live.getLiveInfoList( page,pagesize,"3")!"null">
#if pagedContent.getContent()??>
#assign LiveInfo = pagedContent.getContent()!"null"> #-- LiveInfo数据源 -->
#if LiveInfo??>
#list LiveInfo as liveInfo>
#assign liveId = liveInfo.getLiveId()!"null">
#assign liveInfoUrl = d_live.getLiveInfo("${liveId}")!"null">
#assign liveUrl = liveInfoUrl.getPlayUrl()!"null"> #-- 直播链接地址 -->
{"liveId":"${liveId}","liveUrl":"${liveUrl}"}
#if liveInfo_has_next>
,
/#if>
/#list>
/#if>
/#if>
/#if>
/#if>
]
}
/*异步数据*/
var liveId= $("#liveId").val();
var asyurl="http://wap.cmread.com/rbc/t/liveindex.jsp?vt=9"+"ol=560395";
alert("异步请求之前");
setTimeout(function(){
alert("进入定时器,还没有异步");
$.ajax({
url:asyurl,
type:"POST",
dataType:"json",
success: function(data){
alert("异步获取数据成功");
//var data = eval('('+data+')');
compress = data.compress;
for(var i=0;icompress.length;i++){
alert("进入for循环");
var asyliveId=compress[i].liveId;
if(asyliveId==liveId){
alert("匹配相同");
var liveUrl=compress[i].liveUrl;
$("#live").find("source").attr("src",liveUrl);
}
}
alert("执行第一次支部请求,改变地址是"+$("#live").find("source").attr("src"));
},error:function(){
console.log("error");
}
});
},3000);