how to convert this code to jquery

how to convert this code to jquery

<div dir="ltr">hi,
any one tell how convert below code in jquery
var XMLHttpArray = [
        function() {return new XMLHttpRequest();},
        function() {return new ActiveXObject("Msxml2.XMLHTTP");},
        function() {return new ActiveXObject("Msxml2.XMLHTTP");},
        function() {return new ActiveXObject("Microsoft.XMLHTTP");}
];
function createXMLHTTPObject(){
        var xmlhttp = false;
        for(var i=0; i<XMLHttpArray.length; i++){
                try{
                        xmlhttp = XMLHttpArray[i]();
                }catch(e){
                        continue;
                }
                break;
        }
        return xmlhttp;
}
function AjaxRequest(url,method){
        var req = createXMLHTTPObject();
        req.onreadystatechange= function(){
               
             
             if (req.readyState == 4){
       if (req.status == 200){
       var resarray = req.responseText.split("<#>");
    document.getElementById('question').innerHTML= resarray[0];
    document.getElementById('ans1').value = resarray[1];        
    document.getElementById('ans2').value = resarray[2];
       }
     
       else {
         alert("Error: status code is " + req.status);
       }
        }       
        };
        req.open(method,url,true);
        //req.setRequestHeader('User-Agent', 'My XMLHTTP Agent');
        req.setRequestHeader("Content-Type", "text/html");
        req.send(null);
}
function AjaxResponse(req){
        var respXML=req.responseXML;
        if(!respXML) {return;}
        var respVAL=respXML.getElementsByTagName('family')[0]
.getAttribute('result');
        document.getElementById("status").innerHTML += respVAL;
}
function ClearResponse(){
        mdiv=document.getElementById("status");
        mdiv.innerHTML = "";
}
function MakeRequest(){
    
        AjaxRequest("fn.php?id=1","get");
}
  function handleKeyPress(e){
var key=e.keyCode || e.which;
if (key==13){
check();
//form.submit();
//return false;
}
}
function onclick(event) {
check();
}
function check()
{
var chk = document.getElementById('hash').value ;
var chk1 = document.getElementById('ans1').value;
var chk2 =document.getElementById('ans2').value;
if((chk == chk1) || (chk == chk2))
{
return;
}
else
{
document.getElementById('question').innerHTML= '';
document.getElementById('ans1').value = '';        
  document.getElementById('ans2').value = '';
MakeRequest();
}
}
bye
</div>























































































    • Topic Participants

    • mg