i have a button and onClick I want to move to a different page passing data with POST method.
My actual code is the following and will accomplish to redirect using GET method.
How to do it with POST? I know I can do it with a form, but I can't figure out what is the lightest way to insert a form in my code.
$('.compila').click(function(e){
e.preventDefault();
var id_form=$(this).data("value");
console.log(id_form);
location.href="form_builder.php?id="+id_form;
});
Edit: I have found some similar questions but very outdated. One is suggesting to use a plugin and it is more than 5 years old. I'd prefer to do it without plugins anyway