Viewing topic:Ajax help
Page: 1
Topic post 12-02-2008 - 17:34
Hey guys

I've followed your tutorial about ajax and i think it's a great one.. BUT!

My script dosen't work.. Whats wrong?

<html>
<head>
<title>Ajax</title>
<script type="text/Javascript">
function readPage(x)
{
var pageContent;
if(window.XMLHttpRequest)
{
pageContent = new XMLHttpRequest();
}
else if(window.ActiveXObject)
{
pageContent = new ActiveXObject("Microsoft.XMLHTTP";
}
else
{
alert('The browser dosen't support ajax');
}

pageContent.onreadystatechange = StateChange;
pageContent.open('GET', x, true);
pageContent.send(null);
function StateChange()
{
if(pageContent.readyState == 4)
{
document.getElementById('content').innerHTML = pageContent.responseText;
}
}
</script>
</head>
<body>
<div id="content">
gesadasd
</div>
<div onClick="readPage('test.php')">Click here to use Ajax!</div>
</body>
</html>
Topic post 13-02-2008 - 09:35
Hey, welcome to Combined Minds

Try to save your script in an .js file and load it from an external file. Eg Web-Innovation

JavaScript can be very, very difficult once you gave this kind of problem. I tested your code on my pc, and it also didnt work, i think it's different because it's imbeded in the same page.
Topic post 14-02-2008 - 10:02
Hehe, thanks you for the nice welcome
- I am danish so my english not that good=)
I'll save it as a .js, then i'll come back. Good work with your articles i loove them

EDIT
Dosen't work either - link: http://www.tweis.dk/JScript/ajax.html i want it to load test.php(its, in danish, just click on the link to try)
Topic post 14-02-2008 - 14:03
Did you try copying my .js file from the page i gave you?
Topic post 14-02-2008 - 22:48
Yes i did. But with out any luck, bah
- Maybe i should leave it this time? Thank you anyway for your help.
Topic post 15-02-2008 - 09:50
I don't think we should leave it, or else we'll won't learn what we've done wrong . I don't have time at the moment infortunatly because im at work (and don't have internet at home yet )

But next week im sure we'll solve it!
Topic post 15-02-2008 - 11:26
Thats sounds good and i think you're right. I have to complete what i'm doing
Topic post 25-02-2008 - 14:37
Sorry for being late, busy with practising for my sports (had a tournament this weekend), how is the AJAX doing? Still not working?

©Copyrights Combined Minds. All rights reserved 2006 - 2008 : Disclaimer
Realized by www.Minna-Media.com