按钮在第一次成功的 ajax 数据加载后不起作用
Button is not working after first successful ajax data laod
var Update = {
init: function(){
$('.find').on('click', function(e){
e.preventDefault();
var
$this = $(this),
$form = $('#searchForm');
BLC.ajax({
url: "/emp/find",
type: 'POST',
data: data
},function(data){
$('#findEmployees').html(data);
});
});
}
};
<div id="findEmployees">
<blc:form method="POST" th:action="@{/emp/find" id="searchForm">
<input type="text" th:field="*{employee.id}" name="id" id="id" />
<button id="find" name="find" class="find" type="button"
th:text="Find"></button>
</blc:form>
<blc:form class="detailform" name="detailform"
th:action="@{/emp/deatils}" method="post">
<input type="hidden" th:id="id" th:name="id" th:value="*{id}" />
<a href="#" class="empLink">
<h4 th:text="*{id}"></h4>
</a>
</blc:form>
</div>
因为您要将div 中的内容替换为 Ajax 调用中的新内容,所以需要引用文档并将事件处理程序委托给新添加的代码。
$(document).on('click', '.find', function(e){....
相关文章:
- 将HTML表格导出到excel时,无法将数据加载到excel文件中
- 如何将本地json数据加载到Extjs数据模型中
- FancyTree JS+Backbone.JS-将数据加载到FancyTree时出现问题
- 将数据加载到使用JSON返回的表单字段时出现问题
- 将基本CSV数据加载到D3
- 如何将JSON数据加载到Jqgrid中
- 点击事件时将新的JSON数据加载到Angular中
- 如何使用输入数据加载新的extjs图表
- 读取外部local.txt文件以将数据加载到数组中
- 将数据加载到地图上的更好解决方案
- 将谷歌地理编码(从url)数据加载到javascript变量中
- 按钮在第一次成功的 ajax 数据加载后不起作用
- Jquery 工具提示未随 AJAX 数据加载一起显示
- 将 json 数据加载到 CycleJS 应用程序中
- 将图像数据加载到Angularjs中
- 页面加载前的Angular JS数据加载
- 将数据加载到存储后,Extjs组合框为空
- 将从服务器获取的数据加载到输入文本表单中
- 从 txt 加载数组,将数据加载到 html 中
- 如何将PostgreSQL数据加载到HTML/JS中