ecshop的ajax无刷新异步获取数据技术十分流行,但是我之前的做法是获取一堆json的数值.然后在前端页面由javascript来解析替换html.这样操作比较繁琐。
document.getElementById('listDiv').innerHTML = result.content;
这是由于在服务端,即php文件里已经把数据组合成可以直接显示的html了。
$order_list = order_list();
$smarty->assign('order_list', $order_list['orders']);
$smarty->assign('filter', $order_list['filter']);
$smarty->assign('record_count', $order_list['record_count']);
$smarty->assign('page_count', $order_list['page_count']);
$sort_flag = sort_flag($order_list['filter']);
$smarty->assign($sort_flag['tag'], $sort_flag['img']);
make_json_result($smarty->fetch('order_list.htm'), '', array('filter' => $order_list['filter'], 'page_count' => $order_list['page_count']));
这样ajax前端获取的result.content就是一组html内容了。不用再用js操作替换html (责任编辑:最模板) |

Magento主题模板外贸创意模
人气:457
ecshop仿天猫超市2016整站模
人气:1699
ecshop仿钻石小鸟模板整站
人气:2188
ecshop仿唯棉模板
人气:996
ecshop红酒仿酒仙网模板
人气:1075
shopex西街时尚模板
人气:2155