Files
TowerOptoSifAndSpectral/html/javascript/comment.js
2021-11-11 10:11:47 +08:00

69 lines
1.8 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

function ajaxObject() {
var xmlHttp;
try {
// Firefox, Opera 8.0+, Safari
xmlHttp = new XMLHttpRequest();
}
catch (e) {
// Internet Explorer
try {
xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {
alert("您的浏览器不支持AJAX");
return false;
}
}
}
return xmlHttp;
}
function httppost ( url , data , fnSucceed ){// fnFail , fnLoading ) {
var ajax = ajaxObject();
ajax.open( "post" , url , true );
// ajax.setRequestHeader( "Content-Type" , "application/octet-binary" );
ajax.onreadystatechange = function () {
if( ajax.readyState == 4 ) {
if( ajax.status == 200 ) {
fnSucceed( ajax.response);
//ajax.response.size();
}
else {
// fnFail( "HTTP请求错误错误码"+ajax.status );
}
}
else {
//fnLoading();
}
}
// ajax.responseType="arraybuffer";
ajax.send( data );
}
function httpget ( url , data , fnSucceed ){// fnFail , fnLoading ) {
var ajax = ajaxObject();
ajax.open( "get" , url , true );
// ajax.setRequestHeader( "Content-Type" , "application/octet-binary" );
ajax.onreadystatechange = function () {
if( ajax.readyState == 4 ) {
if( ajax.status == 200 ) {
fnSucceed( ajax.response);
//ajax.response.size();
}
else {
// fnFail( "HTTP请求错误错误码"+ajax.status );
}
}
else {
//fnLoading();
}
}
// ajax.responseType="arraybuffer";
ajax.send( data );
}