I want to display data retrieved by ajax.
For starters, I just echo back from php a number.
Javascript, however, finds my document (in bold below) to be null.
Curiously, this code elsewhere in my script
works just fine.
Can you maybe see where in my code below I've erred?
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()}
}
}