JavaScript變量這是我的代碼: 在一個函數:如何訪問在PHP
var daaa=document.getElementById('da').value= year+ "-" +month+ "-" +day;
document.form1.bookingsession.focus();
var coords = {
"lat": daaa
};
$.get('bs.php', coords, function() {
alert('data sent');
});
和我的PHP代碼:
<?php
$output = isset($_GET['lat']) ? $_GET['lat'] : 0;
print("$output");
?>
當我打印$輸出我得到的值爲0,但實際上必須得到變量daaa上的值。讓我知道我犯的錯誤.... 預先感謝您
將其分解爲最簡單的請求。打開開發人員工具控制檯:'$ .get('bs.php',{lat:50});' - 請求返回什麼? – 2013-03-20 10:27:23
即使將我的編碼替換爲$ .get('bs.php',{lat:50}),它仍會返回值0。 – Ganesh 2013-03-20 11:04:03