I have this weird issue here where I have the following ajax call inside a file called index.php:
$.ajax({
method:'post',
data:
{
action: 'del_comment',
comment_id: comment_id,
},
success: function (data) {
location.reload(true);
}
});
The PHP portion of the page which intercepts the ajax request is the following:
if($_POST['action'] == 'del_comment') {
// Do some processing
die;
}
The issue is that the ajax is executed but when the page is reloaded, the request is a POST instead of a GET. I was under the impression that the following line in the success of my ajax call:
location.reload(true);
Should force a GET request, but it doesn't work. How can I reload the same page with a GET request after the ajax call?