4 回答

TA貢獻2036條經驗 獲得超8個贊
function go() {
var sel_1 = $('#select_1').val();
var sel_2 = $('#select_2').val();
$.post("compute.php", {
select_1 : sel_1,
select_2 : sel_2
}, function (answ) {
console.log(answ);
});
}

TA貢獻1884條經驗 獲得超4個贊
嘗試將您的 go 函數修改為如下所示:
function go() {
var sel_1 = document.getElementById('select_1').value;
var sel_2 = document.getElementById('select_2').value;
$.ajax({
method: "post",
url: "compute.php",
data: {"select_1":sel_1 , "select_2":sel_2},
success: function(data,status)
/* ------------ for debug I have an alert with a response ---- */
{
alert("passed data are: " + data + "\nStatus: " + status);
},
error: function(data,status)
{
alert("passed data are: " + data + "\nStatus: " + status);
}
});
}

TA貢獻2016條經驗 獲得超9個贊
POST 被上面的 .htaccess 指令阻止。已更改,現在 POST 正在從 html 工作,但在使 js/ajax/jquery 工作以將我的數據發布到 compute.php 時仍然存在問題
添加回答
舉報