php - How to input with method Post in javascript
360
I have a code input in javascript code, but it's use method GET
$('#frm-example').on('submit', function(e){ //on submit
var judul = document.getElementById("judul_survey").value;
var kategori= document.getElementById("id_kategori").value;
var target = document.getElementById("viewSelector").value;
window.location.href = "<?php echo base_url() ?>survey/simpan_survey?judul_survey="+judul+"&id_target="+target+"&id_kategori="+kategori;
}
I want to change with method Post, please help me.
Note: I've used the$ _POST
method in its php process
Thanks.
Answer
Solution:
You could use
method to post data using
POST
method.