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
Noob here... Help would be nice :)
Old 08-09-2007, 11:04 PM Noob here... Help would be nice :)
The PHP Professor

Posts: 340
Name: Alex
Location: Behind You
Trades: 0
Hey all, i just bought this book on Ajax because i am a complete noob at it, although i do know a little Java.

I just copied some code out of the book and when i tested it on my website i get errors saying that Access is denied for XMLHttpRequestObject.open


Here is my code i have so far:

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Ajax Test</title>
</head>

<script language="Javascript">

var XMLHttpRequestObject = false;

if (window.XMLHttpRequest) {
    XMLHttpRequestObject = new XMLHttpRequest();
} else if (window.ActiveXObject) {
    XMLHttpRequestObject = new ActiveXObject("Microsoft.XMLHTTP");
}

function getData (dataSource, divID)
{
    if (XMLHttpRequestObject) {
        var obj = document.getElementById(divID);
        XMLHttpRequestObject.open("GET", dataSource);
        
        XMLHttpRequestObject.onreadystatechange = function()
        {
            if (XMLHttpRequestObject.readyState = 4 &&
                XMLHttpRequestObject.status == 200) {
                    obj.innerHTML = XMLHttpRequestObject.responseText;
                }
            }
            XMLHttpRequestObject.send(null);
        }
    }

</script>

<body>

<h1>Fetching data with Ajax</h1>
<form>
    <input type="button" value="Display Message" onclick="getData('http://www.1stopupload.com/beta1/data.txt', 'targetDiv')" />
</form>

<div id="targetDiv">
    <p>The fetched data will go here.</p>
</div>

</body>
</html>
__________________
Go Kirby! <(" . "<) (^" . "^) (>" . ")> Talkupation!
microcolt is offline
Reply With Quote
View Public Profile Visit microcolt's homepage!
 
 
Register now for full access!
Old 08-11-2007, 01:19 PM Re: Noob here... Help would be nice :)
The PHP Professor

Posts: 340
Name: Alex
Location: Behind You
Trades: 0
Wow, i didnt think that something like this would be difficult for people to solve?!

It is a noob script... i think?
__________________
Go Kirby! <(" . "<) (^" . "^) (>" . ")> Talkupation!
microcolt is offline
Reply With Quote
View Public Profile Visit microcolt's homepage!
 
Old 08-11-2007, 06:29 PM Re: Noob here... Help would be nice :)
Junior Talker

Posts: 1
Name: Aaron Burrows
Trades: 0
Been a while since i've touched on AJAX, but for one, are you trying to open a request to another server?
derfleurer is offline
Reply With Quote
View Public Profile
 
Old 08-12-2007, 09:02 AM Re: Noob here... Help would be nice :)
The PHP Professor

Posts: 340
Name: Alex
Location: Behind You
Trades: 0
Quote:
Originally Posted by derfleurer View Post
Been a while since i've touched on AJAX, but for one, are you trying to open a request to another server?
ummm... i dont think so, am i?
__________________
Go Kirby! <(" . "<) (^" . "^) (>" . ")> Talkupation!
microcolt is offline
Reply With Quote
View Public Profile Visit microcolt's homepage!
 
Reply     « Reply to Noob here... Help would be nice :)
 

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.16159 seconds with 12 queries