我想從對話框窗口中的輸入文本字段獲取輸入以將它們用於SQL查詢。我的問題是我不能在PHP中使用數組。我沒有得到任何錯誤或成功的消息。 在Firefox的網絡日誌中,我可以看到具有正確值的Post方法。將jQueryUI對話框中的變量發送到AJAX的PHP對話框
繼承人的我的js代碼片段:
<script>
// open popup window "dialog"
$(function() {
$("#dialog").dialog({
autoOpen: false ,
width: 1000,
buttons: {
"Quelle hinzufügen": function() {
var out = [document.getElementById("titelin"),document.getElementById("autorin"),document.getElementById("tagsin"),document.getElementById("linkin")];
var outv = [out[0].value,out[1].value,out[2].value,out[3].value];
ajax(outv);
},
Abbrechen: function() {
$(this).dialog("close");
}
}
});
$("#opener").click(function(e) {
e.preventDefault();
$("#dialog").dialog("open");
});
});
// posting to PHP
function ajax(outv){
$.ajax({
type:"POST",
url:"quellenverzeichnis.php",
data: {output: outv},
sucess: function(){
alert("works");
},
error: function(){
alert("fail");
}
});
};
</script>
繼承人我的PHP代碼:
<?php
if (isset($_POST['output'])){
hinzufuegen();
};
printf($_POST['output']);
?>
鴕鳥政策知道我做錯了,對不起我的英文不好和德語單詞在代碼中。 感謝您的幫助
'數據:{輸出:BLA}'這哪裏是喇嘛到來從? – vinayakj
那爲什麼你的請求空白,因爲未定義'bla'不會發送'output'字段 – vinayakj
printf($ _ Post ['output']);是錯誤的,你應該使用printf($ _ POST ['output']); – talsibony