使用jQuery刷新特定的div
得到响应后,我想使用ajax调用刷新特定的div标签
<script> $(document).ready(function() {
$('#add-new-department').submit(function(event) {
var departmentname = $('#departmentname').val();
$.ajax({
url : $("#add-new-department").attr("action"),
type : "POST",
data : "departmentname="+departmentname,
success : function(response) {
$('#status').html(response);
$('#departmentname').val('');
$('#department').load("");
}
});
event.preventDefault();
});
});
</script>
我想在jsp页面中更新一条消息
<div id="department">Department Updated : <% new Date(); %> </div>
我的要求是像ajax调用后 div标签
$('#department').refresh();
回答:
$.ajax({ url : $("#add-new-department").attr("action"),
type : "POST",
data : "departmentname="+departmentname,
success : function(response) {
$('#status').html(response);
$('#departmentname').val('');
$('#department').html('Department Updated: ' + new Date());
}
});
以上是 使用jQuery刷新特定的div 的全部内容, 来源链接: utcz.com/qa/434692.html