【问题标题】:Reloading the current page after successful Ajax call [duplicate]Ajax调用成功后重新加载当前页面[重复]
【发布时间】:2021-05-02 14:44:04
【问题描述】:

我有一个使用以下内容的 Ajax 调用:

var ajaxurl = "<?php echo admin_url('admin-ajax.php'); ?>";

// This does the ajax request
$.ajax({
    url: ajaxurl,
    data: {
        'action':'update_sub',
        'data' : new_sub
    },
    success:function(data) {
        // This outputs the result of the ajax request
        console.log(data);
    },
    error: function(errorThrown){
        console.log(errorThrown);
    }
});

提交数据成功后,如何重新加载当前页面?

【问题讨论】:

  • 您是否搜索过“在 JavaScript 中重新加载页面”?

标签: jquery ajax


【解决方案1】:
success:function(data) {
    location.reload();
},

【讨论】:

    猜你喜欢
    • 2011-12-14
    • 1970-01-01
    • 2018-05-09
    • 2020-06-17
    • 1970-01-01
    • 2012-02-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多