admin管理员组

文章数量:1291921

My AJAX is not working and I cannot figure out why. What am I missing??

ReferenceError: xmlhttp is not defined @ javascript.js:5

    function insapts(pin){
        if (window.XMLHttpRequest){ xmlhttpp=new XMLHttpRequest(); }else{ xmlhttpp=new ActiveXObject("Microsoft.XMLHTTP"); }
        xmlhttpp.onreadystatechange=function(){
            if(xmlhttpp.readyState==4 && xmlhttpp.status==200){
                document.getElementById('apttimeins').innerHTML = xmlhttp.responseText;
            }
        }
        var url = "bridge3.php?pin="+pin;
        xmlhttpp.open("GET",url,false);
        xmlhttpp.send(null);
    }

My AJAX is not working and I cannot figure out why. What am I missing??

ReferenceError: xmlhttp is not defined @ javascript.js:5

    function insapts(pin){
        if (window.XMLHttpRequest){ xmlhttpp=new XMLHttpRequest(); }else{ xmlhttpp=new ActiveXObject("Microsoft.XMLHTTP"); }
        xmlhttpp.onreadystatechange=function(){
            if(xmlhttpp.readyState==4 && xmlhttpp.status==200){
                document.getElementById('apttimeins').innerHTML = xmlhttp.responseText;
            }
        }
        var url = "bridge3.php?pin="+pin;
        xmlhttpp.open("GET",url,false);
        xmlhttpp.send(null);
    }
Share Improve this question asked Nov 22, 2013 at 4:32 I wrestled a bear once.I wrestled a bear once. 23.4k20 gold badges72 silver badges121 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 6

You have a typo. The XMLHttpRequest object is created with the local variable name xmlhttpp.

Change

 xmlhttp.responseText;

to

xmlhttpp.responseText;
//     ^ missing p

本文标签: javascriptReferenceError xmlhttp is not definedStack Overflow