AJAX coding help ("undefined"?)?

Discussion in 'Digital Media' started by alto, May 1, 2008.

  1. alto Guest

    alto
    I spaced out my code because Yahoo Answers automatically converts text into "..." if they're too long.


    function loadPage( url )
    {
    var ajaxRequest;
    try { ajaxRequest = new XML Http Request (); }
    catch (e) {
    try { ajaxRequest = new ActiveXObject ("Msxml2. XMLHTTP"); }
    catch (e) {
    try { ajaxRequest = new ActiveXObject ("Microsoft. XMLHTTP"); }
    catch (e) {
    alert("Your browser does not support AJAX");
    return false;
    }
    }
    }

    ajaxRequest. onreadystatechange = function() {
    if(ajaxRequest. readyState == 4){
    document. getElementById(" content"). innerHTML = ajaxRequest. reponseText;
    }
    }

    var theurl = "contents/" + url + ".php";
    ajaxRequest.open ("GET", theurl, true);
    ajaxRequest.send(null);

    }


    Using AJAX, I am trying to load a page when the user clicks a link. However, instead of the content, the text "undefined" shows up.
    alto,
Loading...

Share This Page