我必须传递一个不在我的表单中的变量,所以我在提交之前使用了 ajax 请求
$("#bouton").click(function(){
dureechoisi = $("#duree1").text().replace(/\D/g,'');
alert(dureechoisi);
$.ajax({
type: "POST",
url: "/iframe/simu-test.php",
data : {
dureechoisi1 : dureechoisi
},
dataType: 'json',
xhrFields: {
withCredentials: true
},
async: true
});
$("#resultatform").submit();
});
得到我的变量:$dureechoisi = $_POST['dureechoisi1'];
我的帖子变量为空,我做错了什么?