|
 |
|
ถามเรื่อง ajex ค่ะ ส่งค่าไปแล้วค่าไม่มาอะค่ะ รบกวนช่วยทีค่ะ โค๊ด ตอนส่งค่า .. XMLHttpRequest , responseText , onreadystatechange |
|
 |
|
|
 |
 |
|
รบกวนช่วยทีค่ะ
โค๊ด ตอนส่งค่า
<img src="images/add+to+booking+list.jpg" width="120" height="33" style="CURSOR: pointer" border="0" onClick="select_valuem('loadlist.php','msg','id','chkperson','<?=$result_trek['id']?>');">
โค็ด ajex
var xmlHttp;
function createXMLHttpRequest()
{
if(window.ActiveXObject)
{
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
else if(window.XMLHttpRequest)
{
xmlHttp = new XMLHttpRequest();
}
else
{
alert("Browser error");
return false;
}
}
function select_value(page,show,input)
{
createXMLHttpRequest();
var sText=document.getElementById(input).value;
xmlHttp.open("get",page+sText,true);
xmlHttp.onreadystatechange=function()
{
if(xmlHttp.readyState==4)
{
if(xmlHttp.status==200)
{
displayInfo(xmlHttp.responseText,show);
}
else
{
displayInfo("เกิดข้อผิดพลาดในการเรียก : "+xmlHttp.statusText,show);
}
}
};
xmlHttp.send(null);
}
function select_valuem(page,show,input1,input2,$id)
{
createXMLHttpRequest();
var id1=document.getElementById(input1).value;
var id2=document.getElementById(input2).value;
var id=document.getElementById($id).value;
//alert(id1);
var query;
query="?";
query+="id1="+id1;
query+="&id2="+id2;
query+="&id="+$id;
xmlHttp.open("get",page+query,true);
xmlHttp.onreadystatechange=function()
{
if(xmlHttp.readyState==4)
{
if(xmlHttp.status==200)
{
displayInfo(xmlHttp.responseText,show);
}
else
{
displayInfo("เกิดข้อผิดพลาดในการเรียก : "+xmlHttp.statusText,show);
}
}
};
xmlHttp.send(null);
}
function select_data(page,show,id,act,txt)
{
//alert("Browser error");
createXMLHttpRequest();
var query;
query="?";
query+="id="+id;
query+="&act="+act;
query+="&txt="+txt;
xmlHttp.open("get",page+query,true);
xmlHttp.onreadystatechange=function()
{
if(xmlHttp.readyState==4)
{
if(xmlHttp.status==200)
{
displayInfo(xmlHttp.responseText,show);
}
else
{
displayInfo("เกิดข้อผิดพลาดในการเรียก : "+xmlHttp.statusText,show);
}
}
};
xmlHttp.send(null);
}
function displayInfo(text,show)
{
document.getElementById(""+show+"").innerHTML=xmlHttp.responseText;
}
Tag : - - - -

|
|
 |
 |
 |
 |
Date :
2010-06-23 14:15:31 |
By :
kwangz_07 |
View :
1043 |
Reply :
3 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ส่ง params เกิน ส่งไป 5
select_valuem('loadlist.php','msg','id','chkperson','<?=$result_trek['id']?>');
รับ 3
select_value(page,show,input)
ลองแก้ดู คงยังไม่ต้องบอกนะว่าแก้ยังไง
|
 |
 |
 |
 |
Date :
2010-06-23 14:35:13 |
By :
plakrim |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ต้องกำหนด function นั้น ด้วยเออค่ะ
เข้าใจว่ากำหนดแค่ function select_valuem นี้เท่านั้นเอง เพราะเรียกใช้งานแค่ฟั่งชั่นนี้อะค่ะ
function select_valuem(page,show,input1,input2,$id)
{
createXMLHttpRequest();
var id1=document.getElementById(input1).value;
var id2=document.getElementById(input2).value;
var id=document.getElementById($id).value;
//alert(id1);
var query;
query="?";
query+="id1="+id1;
query+="&id2="+id2;
query+="&id="+$id;
xmlHttp.open("get",page+query,true);
xmlHttp.onreadystatechange=function()
{
if(xmlHttp.readyState==4)
{
if(xmlHttp.status==200)
{
displayInfo(xmlHttp.responseText,show);
}
|
 |
 |
 |
 |
Date :
2010-06-23 14:39:52 |
By :
kwangz_07 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ดันนนนค่ะ ช่วยตอบทีค่ะ
|
 |
 |
 |
 |
Date :
2010-06-23 15:07:18 |
By :
kwangz_07 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 02
|