成功调用 Ajax 后重新加载当前页面

时间:2021-01-28 16:51:50

标签: jquery ajax

我有一个使用以下内容的 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);
    }
});

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

1 个答案:

答案 0 :(得分:1)

success:function(data) {
    location.reload();
},
相关问题