Ajax 参考
来源:互联网 发布:淘宝旗下app有哪些 编辑:程序博客网 时间:2024/06/09 05:06
var httpRequest = false;
var mesdivs = null
function sendRequest(url, mesdiv) {
mesdivs = mesdiv;
httpRequest = false;
if (window.XMLHttpRequest) {
httpRequest = new XMLHttpRequest();
if (httpRequest.overrideMimeType) {
}
}
else if (window.ActiveXObject) {
try {
httpRequest = new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e) {
try {
httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e) {
}
}
}
if (!httpRequest) {
window.alert("no");
}
if (mesdivs == "sendmes") {
httpRequest.onreadystatechange = function() {
if (httpRequest.readyState == 4) {
if (httpRequest.status == 200) {
var string = httpRequest.responseText;
alert(string);
window.parent.document.location.reload();
}
}
}
}
if (mesdivs == "addit") {
httpRequest.onreadystatechange = function() {
if (httpRequest.readyState == 4) {
if (httpRequest.status == 200) {
var string = httpRequest.responseText;
alert(string);
location.reload();
}
}
}
}
if (mesdivs == "addclick") {
httpRequest.onreadystatechange = function() {
if (httpRequest.readyState == 4) {
if (httpRequest.status == 200) {
var string = httpRequest.responseText;
}
}
}
}
if (mesdivs == "confirm") {
httpRequest.onreadystatechange = function() {
if (httpRequest.readyState == 4) {
if (httpRequest.status == 200) {
var string = httpRequest.responseText;
alert(string);
location.reload();
}
}
}
}
if (mesdivs == "AddReply") {
httpRequest.onreadystatechange = function() {
if (httpRequest.readyState == 4) {
if (httpRequest.status == 200) {
var string = httpRequest.responseText;
sendRequest("/DataAccess/getComments.aspx?id=" + parent.document.getElementById("Hidden1").value, "getComments");
alert(string);
SetWinHeight(document.getElementById("win"));
}
}
}
}
if (mesdivs == "addFTopic") {
httpRequest.onreadystatechange = function() {
if (httpRequest.readyState == 4) {
if (httpRequest.status == 200) {
var string = httpRequest.responseText;
if (string == "0") {
alert("提交内容成功!");
location.href = "topic-father.aspx";
}
else if (string == "1") {
alert("提交内容失败");
}
else {
alert("提交内容失败");
}
}
}
}
}
if (mesdivs == "addMTopic") {
httpRequest.onreadystatechange = function() {
if (httpRequest.readyState == 4) {
if (httpRequest.status == 200) {
var string = httpRequest.responseText;
if (string == "0") {
alert("提交内容成功!");
location.href = "topic-mother.aspx";
}
else if (string == "1") {
alert("提交内容失败");
}
else {
alert("提交内容失败");
}
}
}
}
}
if (mesdivs == "addWTopic") {
httpRequest.onreadystatechange = function() {
if (httpRequest.readyState == 4) {
if (httpRequest.status == 200) {
var string = httpRequest.responseText;
if (string == "0") {
alert("提交内容成功!");
location.href = "topic_wedding.aspx";
}
else if (string == "1") {
alert("提交内容失败");
}
else {
alert("提交内容失败");
}
}
}
}
}
if (mesdivs == "getComments") {
httpRequest.onreadystatechange = function() {
if (httpRequest.readyState == 4) {
if (httpRequest.status == 200) {
var string = httpRequest.responseText;
document.getElementById("DivContent").innerHTML = string;
}
}
}
}
if (mesdivs == "getComments2") {
httpRequest.onreadystatechange = function() {
if (httpRequest.readyState == 4) {
if (httpRequest.status == 200) {
var string = httpRequest.responseText;
document.getElementById("DivContent").innerHTML = string;
}
}
}
}
if (mesdivs == "viewCart2") {
httpRequest.onreadystatechange = function() {
if (httpRequest.readyState == 4) {
alert(ttpRequest.status);
if (httpRequest.status == 200) {
var string = httpRequest.responseText;
document.getElementById("divs").innerHTML = string;
}
}
}
}
if (mesdivs == "getCareobject") {
httpRequest.onreadystatechange = function() {
if (httpRequest.readyState == 4) {
if (httpRequest.status == 200) {
var string = httpRequest.responseText;
document.getElementById("info1").innerHTML = string;
}
}
}
}
if (mesdivs == "getReminder") {
httpRequest.onreadystatechange = function() {
if (httpRequest.readyState == 4) {
if (httpRequest.status == 200) {
var string = httpRequest.responseText;
document.getElementById("info2").innerHTML = string;
}
}
}
}
if (mesdivs == "getLogin") {
httpRequest.onreadystatechange = function() {
if (httpRequest.readyState == 4) {
if (httpRequest.status == 200) {
alert(url);
var string = httpRequest.responseText;
alert(string);
document.getElementById("divproInfo").innerHTML = string;
}
}
}
}
if (mesdivs == "addProCookie") {
httpRequest.onreadystatechange = function() {
if (httpRequest.readyState == 4) {
if (httpRequest.status == 200) {
var string = httpRequest.responseText;
}
}
}
}
if (mesdivs == "getCollData") {
httpRequest.onreadystatechange = function() {
if (httpRequest.readyState == 4) {
if (httpRequest.status == 200) {
var string = httpRequest.responseText;
if (string == "0") {
alert("您还没有登录!");
parent.hideWinLay();
}
else if (string == "1") {
alert("收藏成功!");
parent.hideWinLay();
}
else if (string == "2") {
alert("收藏失败!");
parent.hideWinLay();
}
else if (string == "99") {
alert("收藏失败!");
parent.hideWinLay();
}
else {
alert("您已经收藏该礼品!");
parent.hideWinLay();
}
}
}
}
}
if (mesdivs == "getWishData") {
httpRequest.onreadystatechange = function() {
if (httpRequest.readyState == 4) {
if (httpRequest.status == 200) {
var string = httpRequest.responseText;
if (string == "0") {
alert("您还没有登录!");
parent.hideWinLay();
}
else if (string == "1") {
alert("添加愿望成功!");
parent.hideWinLay();
}
else if (string == "2") {
alert("添加愿望失败!");
parent.hideWinLay();
}
else if (string == "99") {
alert("添加愿望失败!");
parent.hideWinLay();
}
else {
alert("您已经将该礼品添加到我的愿望!");
parent.hideWinLay();
}
}
}
}
}
if (mesdivs == "getproInfo") {
httpRequest.onreadystatechange = function() {
if (httpRequest.readyState == 4) {
if (httpRequest.status == 200) {
var string = httpRequest.responseText;
document.getElementById("tab_Recom").innerHTML = string;
}
}
}
}
if (mesdivs == "getHotPro") {
httpRequest.onreadystatechange = function() {
if (httpRequest.readyState == 4) {
if (httpRequest.status == 200) {
var string = httpRequest.responseText;
document.getElementById("divhotpro").innerHTML = string;
}
}
}
}
if (mesdivs == "BindMobile") {
httpRequest.onreadystatechange = function() {
if (httpRequest.readyState == 4) {
if (httpRequest.status == 200) {
var string = httpRequest.responseText;
document.getElementById("HiddenField1").value = string;
St();
}
}
}
}
if (mesdivs == "sendTel") {
httpRequest.onreadystatechange = function() {
if (httpRequest.readyState == 4) {
if (httpRequest.status == 200) {
var string = httpRequest.responseText;
if (string == "0") {
alert("您的用户名或手机错误!");
}
else if (string == "1") {
location.href = "getpass_2_mobile.aspx";
}
else if (string == "3") {
alert("验证码错误!");
}
else {
alert("发送失败,请联系客服!");
}
}
}
}
}
if (mesdivs == "sendPayTel") {
httpRequest.onreadystatechange = function() {
if (httpRequest.readyState == 4) {
if (httpRequest.status == 200) {
var string = httpRequest.responseText;
if (string == "0") {
location.href = "getPaypass_3.aspx";
}
else if (string == "1") {
location.href = "../reg/wrong.htm";
}
else {
location.href = "www.guanxin.com";
}
}
}
}
}
if (mesdivs == "sendEmail") {
httpRequest.onreadystatechange = function() {
if (httpRequest.readyState == 4) {
if (httpRequest.status == 200) {
var string = httpRequest.responseText;
if (string == "0") {
alert("您的邮箱或用户名错误!");
}
else if (string == "1") {
location.href = "getpass_2_email.aspx";
}
else if (string == "3") {
alert("验证码错误!");
}
else {
alert("发送失败,请联系客服!");
}
}
}
}
}
if (mesdivs == "sendPayEmail") {
httpRequest.onreadystatechange = function() {
if (httpRequest.readyState == 4) {
if (httpRequest.status == 200) {
var string = httpRequest.responseText;
if (string == "0") {
location.href = "getPaypass_3.aspx";
}
else if (string == "1") {
location.href = "../reg/wrong.htm";
}
else {
location.href = "www.guanxin.com";
}
}
}
}
}
if (mesdivs == "handledTel") {
httpRequest.onreadystatechange = function() {
if (httpRequest.readyState == 4) {
if (httpRequest.status == 200) {
var string = httpRequest.responseText;
if (string != "0") {
location.href = "getpass_3.aspx?name=" + string;
}
else {
alert("error");
}
}
}
}
}
if (mesdivs == "handledEmail") {
httpRequest.onreadystatechange = function() {
if (httpRequest.readyState == 4) {
if (httpRequest.status == 200) {
var string = httpRequest.responseText;
if (string != "0") {
location.href = "getpass_3.aspx?name" + string;
}
else {
alert("error");
}
}
}
}
}
if (mesdivs == "handledPay") {
httpRequest.onreadystatechange = function() {
if (httpRequest.readyState == 4) {
if (httpRequest.status == 200) {
var string = httpRequest.responseText;
if (string == "0") {
location.href = "../reg/right.htm";
}
else {
location.href = "../reg/wrong.htm";
}
}
}
}
}
else if (mesdivs == "th") {
httpRequest.onreadystatechange = function() {
if (httpRequest.readyState == 4) {
if (httpRequest.status == 200) {
$("ListBox3").options.length = 0;
var string = httpRequest.responseText;
var str = new Array();
str = string.split("|");
for (d = 0; d < str.length; d++) {
var se = new Array();
se = str[d].split(",");
jsAddItemToSelect($("ListBox3"), se[1], se[0]);
}
}
}
}
}
httpRequest.open('get', url, true);
httpRequest.send(null);
}
function GetFirst(a) {
if (a == "se") {
//$("daZhongXiao").innerHTML=$("ListBox1").item.innerText;
$("HiddenField1").value = $("ListBox1").value;
sendRequest("/dataAccess/getsecondtype.aspx?name=" + $("ListBox1").value + "&type=" + a, a);
}
else if (a == "th") {//$("daZhongXiao").innerHTML=$("daZhongXiao").innerHTML+">>"+$("ListBox2").value;
$("HiddenField2").value = $("ListBox2").value;
sendRequest("/dataAccess/getsecondtype.aspx?name=" + $("ListBox2").value + "&type=" + a, a);
}
else {//$("daZhongXiao").innerHTML=$("daZhongXiao").innerHTML+">>"+$("ListBox3").value;
$("HiddenField3").value = $("ListBox3").value;
}
}
function $(a) {
return document.getElementById(a);
}
function jsSelectIsExitItem(objSelect, objItemValue) {
var isExit = false;
for (var i = 0; i < objSelect.options.length; i++) {
if (objSelect.options[i].value == objItemValue) {
isExit = true;
break;
}
}
return isExit;
}
function jsAddItemToSelect(objSelect, objItemText, objItemValue) {
if (jsSelectIsExitItem(objSelect, objItemValue)) {
}
else {
var varItem = new Option(objItemText, objItemValue);
// objSelect.options[objSelect.options.length] = varItem;
objSelect.options.add(varItem);
}
}
function jsRemoveItemFromSelect(objSelect, objItemValue) {
if (jsSelectIsExitItem(objSelect, objItemValue)) {
for (var i = 0; i < objSelect.options.length; i++) {
if (objSelect.options[i].value == objItemValue) {
objSelect.options.remove(i);
break;
}
}
}
else {
}
}
function jsUpdateItemToSelect(objSelect, objItemText, objItemValue) {
if (jsSelectIsExitItem(objSelect, objItemValue)) {
for (var i = 0; i < objSelect.options.length; i++) {
if (objSelect.options[i].value == objItemValue) {
objSelect.options[i].text = objItemText;
break;
}
}
}
else {
}
}
function jsSelectItemByValue(objSelect, objItemText) {
var isExit = false;
for (var i = 0; i < objSelect.options.length; i++) {
if (objSelect.options[i].text == objItemText) {
objSelect.options[i].selected = true;
isExit = true;
break;
}
}
if (isExit) {
}
else
{ }
}
- Ajax 参考
- Google Ajax Search 参考
- ajax框架比较 (参考)
- Ajax极速参考
- Jquery Ajax实例参考
- ajax标准格式参考
- Ajax学习资源参考网址.....
- javasscript ajax请求封装(参考)
- atlas AJAX的一些参考收藏
- Google AJAX Language API开发者参考
- Ajax处理JSON数据参考【学习笔记】
- Ajax使用例子 参考AjaxProject或Struts_Pro3_dingpiao
- ajax入门和学习参考电子书下载
- AJAX基础总结(参考w3school)
- 全面的ASP.NET AJAX学习参考资源
- Google翻译接口 Google AJAX Language API开发者参考
- 原生AJAX调用四步曲:仅供初学者参考
- AJAX(XHR) 与 MSE(Media Source Extensions) 参考代码!
- Visual C++开发工具与调试技巧整理
- 用openssl跟Gmail的smtp对话(一)
- Linux启动 (4)-cpu_idle()进程后运行分析
- 珠海全国软件认证设计考试
- Linux 上JBOSS 启动后只能本机访问,其它机器不能访问问题解决。
- Ajax 参考
- 如何使用links方式安装Eclipse插件
- Preventing Access to OMA and Active Sync Using Security Groups in AD
- Mysql 学习笔记
- UCM 实践的经验教训【转老帖】
- 【转】如何打造十页完美商业计划书
- MFC动态添加控件及响应函数
- Sports Jerseys Supports Passionate
- try