|
|
|
ajax ส่งตัวแปรไม่ได้ครับ ผมอยากให้ตัวแปร id_det_dev ลงค่าไปในฟังก์ชัน getdata แต่มันขึ้นบอกว่า underfine นะครับ |
|
|
|
|
|
|
|
ลองเอาไปประยุกต์ดูนะครับ
Code (PHP)
<script language="JavaScript">
var HttPRequest = false;
function doCallAjax() {
HttPRequest = false;
if (window.XMLHttpRequest) { // Mozilla, Safari,...
HttPRequest = new XMLHttpRequest();
if (HttPRequest.overrideMimeType) {
HttPRequest.overrideMimeType('text/html');
}
} else if (window.ActiveXObject) { // IE
try {
HttPRequest = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
HttPRequest = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {}
}
}
if (!HttPRequest) {
alert('Cannot create XMLHTTP instance');
return false;
}
var url ='data_listdevice.php';
var pmeters =id_det_dev=" + encodeURI( document.getElementById("id_det_dev").value );
HttPRequest.open('POST',url,true);
HttPRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
HttPRequest.setRequestHeader("Content-length", pmeters.length);
HttPRequest.setRequestHeader("Connection", "close");
HttPRequest.send(pmeters);
HttPRequest.onreadystatechange = function()
{
if(HttPRequest.readyState == 3) // Loading Request
{
document.getElementById("mySpan").innerHTML = "Now is Loading...";
}
if(HttPRequest.readyState == 4) // Return Request
{
document.getElementById("mySpan").innerHTML = HttPRequest.responseText;
}
}
}
</script>
|
|
|
|
|
Date :
2010-07-10 15:45:01 |
By :
SOUL |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var pmeters ="id_det_dev=" + encodeURI( document.getElementById("id_det_dev1").value );
/*ค่าตัวนี้ลอง alert ดูแล้วมันไม่มานะครับพี่ช่วยหน่อยครับ.....*/
|
|
|
|
|
Date :
2010-07-10 16:17:05 |
By :
sleepington |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ช่วยหน่อยครับพี่
|
|
|
|
|
Date :
2010-07-10 16:20:43 |
By :
sleepington |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var option = document.getElementById('id_det_dev');
alert(option.options[option.selectedIndex].value);
|
|
|
|
|
Date :
2010-07-10 16:30:32 |
By :
pjgunner |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 03
|