Original pagination script

This is my pagination script, and I wonder why I get these errors in IE:

function GetXmlHttpObject(){
  var a;
  try{
    a=new ActiveXObject("Msxml2.XMLHTTP");
  }
  catch(d){
    try{
      a=new ActiveXObject("Microsoft.XMLHTTP");
    }
    catch(c)
    {a=false;}
  }
  if(!a&&typeof XMLHttpRequest!="undefined")
  {
    try{
      var a=new XMLHttpRequest();
    }
    catch(d){
      var a=false;
    }
  }
  return(a);
}
var i=0;var ii=0;var b=0;var bb=0;

function ForumPagination(c){
  document.getElementById("forumsblock").style.display="none";
  document.getElementById("WaitDiv").innerHTML="<img src='images/loading.gif' >";
  xmlHttp=GetXmlHttpObject();
  if(xmlHttp==null){
    alert("Your browser does not support AJAX!");
    return;
  }
  var a="indext.php?name=Dynamic_forums&pagenum="+c;
  xmlHttp.open("GET",a,true);xmlHttp.onreadystatechange=ReplyLoading;xmlHttp.send(null);
}

function ReplyLoading(){
  if(xmlHttp.readyState==2||xmlHttp.readyState==4){
    var a=xmlHttp.responseText;
    document.getElementById("WaitDiv").innerHTML=""+a;
  }
}

script works fine in FF

btw, when I change the page, I cannot do it again.

Webpage Error Details

Message: 'getLoad' - undefined Line: 105 Char: 311 Code: 0 URI: http://nukelearn.com/

Message: The data needed to complete this operation is not yet available.

Line: 9 Char: 74 Code: 0 URI: http://nukelearn.com/includes/199233334JOE.js

Message: Object required String: 3 Char: 1 Code: 0 URI: http://nukelearn.com/includes/199233334JOE.js

Message: Object required String: 3 Char: 1 Code: 0 URI: http://nukelearn.com/includes/199233334JOE.js

Message: Object required String: 3 Char: 1 Code: 0 URI: http://nukelearn.com/includes/199233334JOE.js

Message: Object required String: 3 Char: 1 Code: 0 URI: http://nukelearn.com/includes/199233334JOE.js

Message: Object required String: 3 Char: 1 Code: 0 URI: http://nukelearn.com/includes/199233334JOE.js

Message: Object required String: 3 Char: 1 Code: 0 URI: http://nukelearn.com/includes/199233334JOE.js

Message: Object required String: 3 Char: 1 Code: 0 URI: http://nukelearn.com/includes/199233334JOE.js

+3
source share
4

jQuery: ( , javascript )

+4

- :

window.onload = getLoad;

getLoad , . IE, , .

, readyState XmlHttp. :

if(xmlHttp.readyState==2||xmlHttp.readyState==4){

MSDN, readyState 2:

2 () . responseText . responseBody .

, readyState 2 ( responseText), , . :

if(xmlHttp.readyState==4){

question readyState (: - 4).

, , jQuery , , , XmlHttp -.

+1

:

function GetXmlHttpObject(){
    return !!window.XMLHttpRequest ? window.XMLHttpRequest : new ActiveXObject("Microsoft.XMLHTTP");
}

, .

0

Source: https://habr.com/ru/post/1730752/


All Articles