Is it possible to submit POST data to a PHP script using only jQuery, without a form on the page and with page refresh?
Redirection
$(document).ready(function(){
$('.button').click(function(){
window.location.replace('index.php?some_value=1');
});
});
In this example GET data is sent, but how can I send POST data with this redirection?
POST
$(document).ready(function(){
$('.button').click(function(){
$.post(
'index.php',
{
some_value: '1'
}, function(result) {
alert(result);
}
);
});
});
This example will not refresh the page.