jQuery+ajax,添加,动态
web前端-js教程功能:ajax获取后台返回数据给table动态添加tr/td
彩虹秒赞源码安全吗,vscode界面怎么缩大,Ubuntu网页管理,同时发布多个tomcat,header爬虫代码,php 异步上传文件,大同seo优化联系人,动易网站 自定义邮箱,织梦模板论坛lzw
html部分:在线流程图源码,ubuntu内核编译选项,爬虫实战模拟登录,php关闭端口,狮吼功seolzw
ajax部分:
知识库 源码,vscode格式化最大换行,ubuntu路径变量,苹果tomcat项目路径,草鞋爬虫图片,php 日程安排,四川seo网络推广方案,网站首页图片切换lzw
var year = $('#year').val();//下拉框数据var province= $('#province').val();//下拉框数据$('table tbody').html('');$.ajax({ url:"/Plan/sendJson.html", type:"get", data:{ 'year':year, 'province':province }, datatype:'json', success:function(data){ switch(data.msg) { case '0': $('table tbody').prepend('');break; case '1': $.each(data.data,function(i,n){var $tr = $(" 暂无数据 "+" ");var $table = $('table tbody');$table.append($tr);});}}})"+n.year+" "+""+n.province+" "+"
php后台(thinkPHP处理):
$year = I('get.year');$province = I('get.province');$condition = array();$year && $condition = array('eq',$year);$province && $condition = array('eq',$province);$dataList = M('Plan')->where($condition)->select();if(false != $dataList){ $data['msg'] = '1'; $data['data'] = $dataList; echo json_encode($data); exit;}else{ $data['msg'] = '0'; $data['data'] = ''; echo json_encode($data); exit;}