div.load()方式局部刷新div

主页面部分

<section class="content-header">
<h5>
数据字典
</h5>
</section>
<!-- Main content -->
<section class="content">
<div class="row">
<div class="col-md-6">
<div class="box">
<div class="box-header with-border">
<h6 class="box-title">数据类型</h6>
<a class="btn btn-primary btn-flat btnbt pull-right" href="javascript:toadddatatype();">新增数据类型</a>
</div><!-- /.box-header -->
<div class="box-body table-responsive no-padding" style="overflow-x:hidden">
<table class="table table-hover table-text " id="typetable">
<thead>
<tr class="tabth" >
<th>序号</th>
<th>类型名称</th>
<th>类型代码</th>
<th style="padding-left: 20px;">操作</th>
</tr>
</thead>
<tbody>
<c:forEach items="${datatypelist }" var="datatypelist" varStatus="s">
<tr onclick="clicktr(${datatypelist.id });">
<td>${s.index+1 }</td>
<td>${datatypelist.typename }</td>
<td>${datatypelist.typecode }</td>
<td>
<a class="fa fa-trash fa-lg text-danger" href="javascript:deletedatatype(${datatypelist.id })"></a>
<a class="fa fa-pencil fa-lg" style="margin-left: 20px;" href="javascript:toupdatedatatype(${datatypelist.id })"></a>
</td>
</tr>
</c:forEach>
</tbody>
</table>
</div><!-- /.box-body -->
</div>
<!-- /.box -->
</div><!-- /.col -->

<div class="col-md-6">
<div class="box" id="Data">
<div class="box-header with-border">
<h6 class="box-title">数据字典</h6>
<a class="btn btn-primary btn-flat btnbt pull-right" href="javascript:toadddatadictionary();">新增数据</a>
</div><!-- /.box-header -->
<div class="box-body table-responsive no-padding" style="overflow-x:hidden" >
<table class="table table-hover table-text " id="datatable">
<thead>
<tr class="tabth" >
<th>序号</th>
<th>分类</th>
<th>键</th>
<th>值</th>
<th style="padding-left: 20px;">操作</th>
</tr>
</thead>
</table>
</div><!-- /.box-body -->
</div>
<!-- /.box -->
</div>

</div><!-- /.row -->
</section><!-- /.content -->

javascript

//类型与数据表联动
function clicktr(typeid){
$("#Data").load("${ctx }/system/dictionary/selectdatabyid?typeid="+ typeid,function(response,status,xhr){   //div的id用来load刷新   请求后台
if(status!="success"){
if(xhr.status==444){
alert(xhr.responseText);
}
else{
alert(status);
}

}
}
);
}

---------------------------------------------------------------------------------------------------------------------------------------------------

次页面,用来更新div的内容  刷新

<div class="box-header with-border">
<h6 class="box-title">数据字典-${datatype.typename }</h6>
<a class="btn btn-primary btn-flat btnbt pull-right" href="javascript:toadddata(${datatype.id });">新增数据</a>
</div><!-- /.box-header -->
<div class="box-body table-responsive no-padding" style="overflow-x:hidden" >
<table class="table table-hover table-text " id="datatable">
<thead>
<tr class="tabth" >
<th>序号</th>
<th>分类</th>
<th>键</th>
<th>值</th>
<th style="padding-left: 20px;">操作</th>
</tr>
</thead>
<tbody>
<c:forEach items="${ datalist}" var="datalist" varStatus="s">
<tr>
<td>${s.index+1 }</td>
<td>${datalist.typename }</td>
<td>${datalist.paramkey }</td>
<td>${datalist.paramvalue }</td>
<td>
<a class="fa fa-trash fa-lg text-danger" href="javascript:deletedatadictionary(${datalist.id },${datalist.typeid });"></a>
<a class="fa fa-pencil fa-lg" style="margin-left: 20px;" href="javascript:toupdatedatadictionary(${datalist.id });"></a>
</td>
</tr>
</c:forEach>
</tbody>
</table>
</div><!-- /.box-body -->

-----------------------------------------------------------------------------------------------------------------------------------------

Controller

/**
* 两张表格联动
* @author cjq
* 2017年2月24日
*/
@RequestMapping("/selectdatabyid")
public String selectdatabyid(
@RequestParam(value = "typeid", required = false) Integer typeid,
Model model, HttpServletRequest request,
HttpSession session) {
List<DataDictionary> datalist=dictionaryservice.selectdatabytypeid(typeid);
request.setAttribute("datalist", datalist);
DataType datatype=dictionaryservice.selectdatatypebyid(typeid);
model.addAttribute("datatype", datatype);
return "system/dictionarydata";      //返回次页面刷新div
}

时间: 2024-08-25 05:43:53

div.load()方式局部刷新div的相关文章

jquery使用load开展局部刷新没有效果

jquery使用load开展局部刷新没有效果 jquery使用load进行局部刷新没有效果我的代码 <html><head><meta charset="utf-8"><title>无标题文档</title><script src=""$amp;>amp;$lt;/script><script language="javascript">function r

jquery ajax配合SpringMVC实现局部刷新DIV

feedback.jsp: <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <% String path = request.getContextPath();

jQuery翻页yunm.pager.js,涉及div局部刷新

前端的翻页插件有很多,bootstrap的翻页界面看起来就不错,做起来也易于上手,但应用于项目中的翻页实现还有有几个难点,分别是: 如何封装一个翻页插件,如题中的yunm.pager.js. 涉及到的div局部刷新该如何做. 翻页的总体流程涉及到的知识点很多,这篇文章我们也主要来关注以上两点,其余的内容,请自悟. 一.如何定义局部刷新的div 翻页时,我们一般只会刷新页面中涉及到翻页的父级div,那么该如何定义呢? <form rel="support_deal_page" ta

(局部刷新)jquery.ajax提交并实现单个div刷新

web开发中我们经常会遇到局部刷新页面的需求,以前我经常使用ajax和iframe实现局部刷新,后来做政府的项目,对页面的样式要求比较多,发现使用iframe控制样式什么的很麻烦,所以就采用了新的办法,就是下面我们要说的ajax配合div局部刷新页面,其实很简单,下面我们就看一下这种刷新方式是如何实现的. jsp页面ajax代码如下: $("#waitWork").click(function(){ var url = "请求地址"; var data = {typ

jquery的div局部刷新

//div的局部刷新 $(".dl").load(location.href+" .dl"); 全页面的刷新方法 window.location.reload()//刷新当前页面. parent.location.reload()//刷新父亲对象(用于框架) opener.location.reload()刷新父窗口对象(用于单开窗口) top.location.reload()//刷新最顶端对象(用于多开窗口)

jQuery 局部刷新(div刷新及全局刷新)

$(".dl").load(location.href+" .dl");  //div局部刷新 window.location.reload()  //刷新当前页面. parent.location.reload()   //刷新父亲对象(用于框架) opener.location.reload()  //刷新父窗口对象(用于单开窗口) top.location.reload()     //刷新最顶端对象(用于多开窗口) 原文地址:https://www.cnbl

指定DIV局部刷新的简单实现,很简单,但是网上搜到的大部分都很复杂

脚本部分: <script type="text/javascript"> $(function () { setInterval(function () { $("#autore").load(location.href + " #autore");//注意后面DIV的ID前面的空格,很重要!没有空格的话,会出双眼皮!(也可以使用类名) }, 8000);//8秒自动刷新 }) </script> 刷新DIV部分: &l

利用jquery load 局部刷新数据

本文属于新手型的文章,也是新手写的文章,高手可以滤过,如果各位看了有什么意见,尽管提,小鸟虚心接受............. 都来拍砖吧. 在asp.net 的ajax中有updatepanel,但我不想用这个,就想到了jquery,看能否实现相同的功能,于是去搜索相关文章,但是也有人问,却没有给出完整的demo,但是jquery中有load方法可以实现 问题:在某篇文章的详细页,[ http://www.e6wa.com/Article/107.aspx ]提交评论的时候,不希望刷新整个页面,

ext.js 两种局部刷新的方式

$.ajax({ type: "POST", url: "AjaxAlgorithmOptimzeHandler.ashx?cmd=yhtrafficFlow", data: 'encoded=' + encoded, dataType: 'json', success: function (msg) {//msg其实就是Car类的一个实例 等价 car1 alert(msg); } }); 1 listeners: { 2 click: function (a,