jquery如何输出数据?
<script>varfilemList;functiongetScheduleInfo(index){if(index==1){$.post('__APP__/Home...
<script>
var filemList;
function getScheduleInfo(index) {
if (index == 1) {
$.post('__APP__/Home/Schedule/sel/t_time/<{$t_time}>/sel/1',
function(data) {
filemList = eval("(" + data + ")");
setSchedule()
});
} else if (index == 2) {
$
.post(
'__APP__/Home/Schedule/sel/m_time/<{$t_time+24*3600}>/sel/2',
function(data) {
filemList = eval("(" + data + ")");
setSchedule()
});
} else {
$
.post(
'__APP__/Home/Schedule/sel/w_time/<{$t_time+48*3600}>/sel/3',
function(data) {
filemList = eval("(" + data + ")");
setSchedule()
});
}
}
function setSchedule() {
var fileDiv = $("#film_show");
????
}
</script> 展开
var filemList;
function getScheduleInfo(index) {
if (index == 1) {
$.post('__APP__/Home/Schedule/sel/t_time/<{$t_time}>/sel/1',
function(data) {
filemList = eval("(" + data + ")");
setSchedule()
});
} else if (index == 2) {
$
.post(
'__APP__/Home/Schedule/sel/m_time/<{$t_time+24*3600}>/sel/2',
function(data) {
filemList = eval("(" + data + ")");
setSchedule()
});
} else {
$
.post(
'__APP__/Home/Schedule/sel/w_time/<{$t_time+48*3600}>/sel/3',
function(data) {
filemList = eval("(" + data + ")");
setSchedule()
});
}
}
function setSchedule() {
var fileDiv = $("#film_show");
????
}
</script> 展开
2个回答
展开全部
首先,jQuary的statement最好都放在
$(document).ready(
//里面哦
);
//然后,既然是判断模块了,用switch不是更好?
switch(index)
{
case 1:
$.post('__APP__/Home/Schedule/sel/t_time/<{$t_time}>/sel/1',
function(data) {
filemList = eval("(" + data + ")");
setSchedule()
});
break;
case 2:
//不重复了
default:
//不重复了
}
前面是与问题无关的代码优化,两边的回调函数一样其实也可以提出来。
请追问:
你说的输出是要输出到那个部分?是到网页的一个块还是到本地储存或者服务端?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询