阿賈克斯阿賈克斯得到的PHP值
$(document).ready(function(){
$("#diklat").change(function(){
var diklat = $("#diklat").val();
$.ajax({
url: "function.php",
data: {'action': 'diklat'},
cache: false,
success: function(msg){
$("#angkatan").html(msg);
}
});
});
PHP
$get_action = $_GET['action'];
if($get_action=='diklat'){
$diklat = $_GET['diklat'];
$angkatan = mysql_query("SELECT id,name FROM batches WHERE IdMasterDiklat='$diklat' order by id");
echo "<option>-- Pilih Angkatan --</option>";
while($p = mysql_fetch_array($angkatan)){
echo "<option value=\"".$p['id']."\">".$p['name']."</option>\n";
}
}
值didnt包括我的阿賈克斯,阿賈克斯只讀回聲。如何獲得該值
使用'$ _GET [ '行動']'代替'$ _GET [ 'diklat']在您的JS代碼數據' – Saty
:{ '行動': 'diklat'},應該是數據:{'action':diklat}, – vishwakarma09
@ vishwakarma09沒有什麼變化 – kamenrider