0
嗨,我有以下代碼,但我無法訪問我的request.php文件中的值。我怎樣才能通過使用AJAX的選擇框中傳遞兩個值
$(document).ready(function(){
$("select.location").change(function(){
var Did = $("input[name='district']").val();
var selectedLocation = $(".location option:selected").val();
$.ajax({
type: "GET",
url: "request.php",
data: {location : selectedLocation, Did:Did},
}).done(function(data){
$("#response").html(data);
});
});
});
和我request.php呼籲這樣
if(isset($_GET["location"]))
{
$i=0;
$bfrom = $_GET["location"];
$did= $_GET["Did"];
$sql = "SELECT distinct stopname FROM `route` WHERE `rfrom` LIKE '$bfrom' and did=$did";
$result = $conn->query($sql);
使用json傳遞多個值 – guradio