详解php+ajax开发的注意事项(2)_PHP教程
教程Tag:暂无Tag,欢迎添加,赚取U币!
推荐:解析用PHP操作MySql数据库?php /* *mysql数据库分页类 *@packagepagelist *@authoryytcpt(无影) *@version2008-03-27 *@copyrigthhttp://www.d5s.cn/ */ /* *分页样式 .page{float:left;font:11pxArial,Helvetica,sans-serif;padding:6px0;margin:0px10%;margin-top:10px;} .pagea,.pa
3.1JS部分
function processRequest() {
var tran;
if (httpRequest.readyState == 4 || httpRequest.readyState == "complete") {
if (httpRequest.status == 200 || httpRequest.statusText == "OK") {
tran = httpRequest.responseText;
//setGlobalValue(tran);
alert(tran);
} else {
alert("您所请求的页面发生错误!");
}
}
}
function sendRequest(strurl) {
httpRequest = false;
if (window.XMLHttpRequest) { // Mozilla, Safari, ...
httpRequest = new XMLHttpRequest();
} else if (window.ActiveXObject) { // IE
try {
httpRequest = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {}
}
}
if (!httpRequest) {
window.alert("通讯失败");
return false;
}
httpRequest.onreadystatechange = processRequest;
httpRequest.open("GET", strurl, true);
httpRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
httpRequest.send(null);
}>}
function processRequest() {
var tran;
if (httpRequest.readyState == 4 || httpRequest.readyState == "complete") {
if (httpRequest.status == 200 || httpRequest.statusText == "OK") {
tran = httpRequest.responseText;
//setGlobalValue(tran);
alert(tran);
} else {
alert("您所请求的页面发生错误!");
}
}
}
分享:解析用PHP操作MySql数据库(DB类)?php /* *mysql数据库DB类 *@packagedb *@authoryytcpt(无影) *@version2008-03-27 *@copyrigthhttp://www.d5s.cn/ */ classdb{ varconnection_id=; varpconnect=0; varshutdown_queries=array(); varqueries=array(); varquery_id=; varquery_count=0; v
相关PHP教程:
- 相关链接:
- 教程说明:
PHP教程-详解php+ajax开发的注意事项(2)。