當前位置:編程學習大全網 - 源碼下載 - 如何用php和ajax結合實現登錄

如何用php和ajax結合實現登錄

<script language="javascript">

function getXMLHTTPRequest()

{

var xRequest=null;

if (window.XMLHttpRequest)

{

xRequest=new XMLHttpRequest();

}

else if (typeof ActiveXObject != "undefined")

{

xRequest=new ActiveXObject("Microsoft.XMLHTTP");

}

return xRequest;

}

function Ajax(url)

{

AjaxObj = getXMLHTTPRequest();

AjaxObj.onreadystatechange = processRequest;

AjaxObj.open("post",url,true);

AjaxObj.setRequestHeader('Content-type','application/x-www-form-urlencoded');

AjaxObj.send("name"+name);

}

function processRequest()

{

if(AjaxObj.readyState == 4)

{

if(AjaxObj.status == 200)

{

if(AjaxObj.responseText != "")

{

document.getElementById("show").innerHTML="";

//alert(AjaxObj.responseText);

document.getElementById("show").innerHTML=AjaxObj.responseText;

}

}

else

{

alert("您所請求的頁面有異常。")

}

}

else

{

document.getElementById("show").innerHTML="Loading......";

}

}

</script>

這是我在項目中用到的..

用onclick="Ajax(***.php)";調用就行..

這估計不能完全試用妳的項目..思路是這樣的.

如不明白加我qq:48123386 寫明驗證信息

  • 上一篇:java高手幫幫忙!!急!
  • 下一篇:通達信超級指數公式源代碼
  • copyright 2024編程學習大全網