I want to display data fetched via ajax.
To keep it simple at first, my ajax module simply echoes back a number.
But already javascript finds the element,
marked in red below, as being null.
Can you point out my mistake?
function grabItemHist() { http = getHTTPObject();
var item = document.getElementById("itemid").value;
url = "ajaxGrabItemHist.php?itemid=" + item;
http.open("GET", url, true);
http.onreadystatechange = showItemHist;
http.send(null); }
function showItemHist() { if (http.readyState == 4) {var results = http.responseText;
itemWin=window.open('','itemscr','height=300,width =350');
var tmp = itemWin.document;
tmp.write('<html><head><title>Item History</title></head>');
tmp.write('<body><p>Items:</p>');
tmp.write('<p>Found this many items: '+results+'</p>');
tmp.write('</body></html>');
tmp.close();
if (window.focus) {itemWin.focus()} } }
|