【发布时间】:2021-10-13 11:39:38
【问题描述】:
我正在尝试刷新页面的一部分。更具体地说,它是一个带有“类名”的划分标签。我试图让事情简单明了,以避免混淆。如何将部分页面刷新添加到当前代码块中的单个类?请注意,代码似乎完全符合我的要求。我只需要添加部分页面刷新来完成它,但我不知道该怎么做。
<script type="text/javascript">
$('form').on('submit', function() {
var that = $(this),
url = that.attr('action'),
type = that.attr('method'),
data = {};
that.find('[name]').each(function(index, value) {
//console.log(value);
var that = $(this),
name = that.attr('name'),
value = that.val();
data[name] = value;
});
//console.log(data);
//now we are using ajax
$.ajax({
url: url,
type: type,
data: data,
success: function() {
//console.log(response);
//I think I would put the code for a page refresh here???
}
});
return false;
});
</script>
非常感谢您的时间和精力。
【问题讨论】: