Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
Why is my javascript document null?
Old 07-14-2008, 02:44 PM Why is my javascript document null?
Average Talker

Posts: 19
Name: Meir Ech
Trades: 0
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()}
}
}
ruffy is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 07-15-2008, 09:21 PM Re: Why is my javascript document null?
logic ali's Avatar
Super Talker

Posts: 104
Trades: 0
Quote:
Originally Posted by ruffy View Post
Code:
function showItemHist() {
if (http.readyState == 4) {
var results = http.responseText; itemWin=window.open('','itemscr','height=300,width=350'); var tmp = itemWin.document;
I suspect it's being blocked since it's not the direct result of a user action. Try disabling popup blocking completely.
logic ali is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Why is my javascript document null?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.10421 seconds with 12 queries