|
|
|
สงสัยเรื่อง Ajax กับการส่งค่า pmeters มากกว่า 1 ค่า อะครับ งงมากมาย |
|
|
|
|
|
|
|
Code (PHP)
<script language="JavaScript">
var HttPRequest = false;
function doCallAjax3() {
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 = '../script/checkpass2_ctm.php';
var pmeters = "tPassword=" + encodeURI( document.getElementById("password_ctm").value) + "tPassword2=" + encodeURI( document.getElementById("password_ctm_re").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_3").innerHTML = "..";
}
if(HttPRequest.readyState == 4) // Return Request
{
if(HttPRequest.responseText == 'Y')
{
window.location = 'AjaxPHPRegister3.php';
}
else
{
document.getElementById("mySpan_3").innerHTML = HttPRequest.responseText;
}
}
}
}
</script>
Code (PHP)
<?php
$strPassword = trim($_POST["tPassword"]);
$strPassword2 = trim($_POST["tPassword2"]);
if(trim($tPassword2) == "")
{
echo "<img src='img/false.png'>";
exit();
}
if($strPassword != $strPassword2 ) {
?>
<img src="../img/False.gif" width="16" height="16">
<?
}
else
{
?>
<img src="../img/true.gif" width="16" height="16">
<?
}
?>
Tag : PHP, MySQL, JavaScript, Ajax
|
ประวัติการแก้ไข 2011-02-03 14:13:19
|
|
|
|
|
Date :
2011-02-03 13:58:54 |
By :
Error@ |
View :
900 |
Reply :
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ผิดตรงไหนไม่รู้ งงมากมาย
|
|
|
|
|
Date :
2011-02-03 13:59:43 |
By :
Error@ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ได้แล้วจ่า ขอบคุณ www.thaicreate.com/
|
|
|
|
|
Date :
2011-02-03 14:54:13 |
By :
Error@ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 03
|