我想在执行函数后刷新页面
I want to refresh a page after a function is executed?
function theFinale()
{ document.getElementById("pop2").style.display = 'none';
document.getElementById("myPopup").style.display = 'none';
document.getElementById("pop3").style.display = 'none';
document.getElementById("pop4").style.display = 'block';
document.getElementById('pop4').style.position = "absolute";
document.getElementById('pop4').style.top = '250px';
document.getElementById('pop4').style.left = '250px';
setTimeout(function(){
document.getElementById('pop4').className = 'waa';
}, 2500);
window.line=document.getElementById('answer').value;
{
$.ajax({
type: 'POST',
url: 'qwe.php',
data: {z: line},
success: function(data) {
$("q").text(data);
}
});
document.getElementById('answer').reset();
}
window.location.href=window.location.href;
}
我想在执行此函数后刷新。 我在 HTML 表单中获取的所有表单值也应该重置。
$.ajax()
异步返回结果。window.location.href=window.location.href
移至success
$.ajax()
的功能。删除$.ajax()
调用之前{
的两个语法错误,并在document.getElementById('answer').reset();
之后}
。提供setTimeout
的标识符,并在success
调用clearTimeout()
theFinale
功能之外
var timeout = null;
timeout = setTimeout(function(){
document.getElementById('pop4').className = 'waa';
}, 2500);
success: function(data) {
clearTimeout(timeout);
window.location.href=window.location.href;
}
success: function(data) {
$("q").text(data);
location.reload()
}
你试过这个吗?
相关文章:
- 停止对document.ready函数的重定向/刷新
- 刷新按钮以调用javascript函数
- j查询如何在加载了 load() 函数的页面上进行 POST/AJAX,而无需刷新页面
- 如何等到iframe刷新完成后再执行函数
- 如何使用AJAX函数在不刷新页面的情况下发送表单,我缺少什么?我必须为此使用休息框架吗?
- Javascript 函数在页面刷新时不可用
- onchange 函数需要时间来刷新页面
- 如何将数据从表单传递到 php 函数到 javascript 以在画布上绘制而不刷新页面
- 需要 Ajax 函数 - 在不刷新页面的情况下更新数据库
- 使用 Javascript 在页面刷新时调用函数
- 刷新函数未正确调用 d3
- AJAX/JQuery:提交表单和调用函数而不刷新页面
- 如何在不刷新页面的情况下多次执行构造函数
- jQuery - 刷新每个()函数
- Jquery 移动函数不起作用 == 页面刷新
- 具有剑道网格刷新的回调函数
- 页面刷新函数的回调函数
- 刷新函数内的javascript if语句
- 如何处理IE中多次刷新函数的框背景颜色
- 更新刷新函数中的挖空可观察字符串