ajax.js 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. function createXMLHttpRequest() {
  2. try {
  3. XMLHttpReq = new ActiveXObject("Msxml2.XMLHTTP");
  4. } catch(e) {
  5. try {
  6. XMLHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
  7. } catch(e) {
  8. XMLHttpReq = new XMLHttpRequest();
  9. }
  10. }
  11. }
  12. function CheckGrade() {
  13. createXMLHttpRequest();
  14. XMLHttpReq.open("GET", "?c=ajax&a=grade", true);
  15. XMLHttpReq.onreadystatechange = function() {
  16. if (XMLHttpReq.readyState == 4) {
  17. if (XMLHttpReq.status == 200) {
  18. var data = eval("(" + XMLHttpReq.responseText + ")");
  19. var grade = data.grade > 0 ? "yes" : "no";
  20. $("#grade").attr('src', "static/admincp/image/show_" + grade + ".gif");
  21. $("#enddate").html(data.enddate);
  22. }
  23. }
  24. };
  25. XMLHttpReq.send(null);
  26. }
  27. function CheckBuild() {
  28. createXMLHttpRequest();
  29. XMLHttpReq.open("GET", "?c=ajax&a=build", true);
  30. XMLHttpReq.onreadystatechange = function() {
  31. if (XMLHttpReq.readyState == 4) {
  32. if (XMLHttpReq.status == 200) {
  33. var data = XMLHttpReq.responseText;
  34. if (data.match(/^\d+/)) {
  35. parent.$("#build").html(data);
  36. parent.$("#notice").show();
  37. }
  38. CheckGrade();
  39. }
  40. }
  41. };
  42. XMLHttpReq.send(null);
  43. }