我在javascript代码中输入了代码,但是使用方法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;
}
我想用方法Post改变,请帮帮我
注意:我在php进程中使用了$ _POST
方法
感谢。
答案 0 :(得分:0)
您可以使用 $.post
方法使用POST
方法发布数据。
$('#frm-example').on('submit', function(e){
$.post("survey/simpan_survey",
{ judul_survey: judul, id_target: target },
function(data, status){
alert("Data: " + data + "\nStatus: " + status);
})
});