techPowerUp! Forums

Go Back   techPowerUp! Forums > Software > Programming & Webmastering

Reply
 
Thread Tools
Old Mar 19, 2008, 05:12 AM   #1
aximbigfan
500 Posts
 
aximbigfan's Avatar
 
Join Date: Oct 2006
Location: St. Louis, MO
Posts: 554 (0.23/day)
Thanks: 51
Thanked 35 Times in 28 Posts
Send a message via AIM to aximbigfan

System Specs

Very simple script in AJAX doesn't work...

I have been trying my hardest, but no matter what, nothing I code with AJAX works .

Here is a very, very simple script just to get the time from a PHP file I have, that echoes the time, and put it in a text box called "timebox". It puts "undefined" in the box instead. I know for a fact fro my servers 404 logs that it is getting all the files it needs, but still.

Lets just assume that who ever is accessing the page is using Firefox. I'll change it after I get it to work.

Code:
<script type='text/javascript'>
function time()
{
var http = new XMLHttpRequest();

http.onreadystatechange=function()
{
if (http.readyState==4)
{
document.time.timebox.value=http.responceText;
}
}
http.open("GET","../libs/time.php", true);
http.send(null);
}
</script>";
<form name='time'><input type='text' name='timebox'><input type='button' value='Server Time' name='timebutton'  onclick="document.location.href='javascript:time();'"></form>
Also, why is it that when I have buttons with functions in them, for example onclick='function()', it never works? I always have to put onclick="document.location.href='javascript:functi on();'"

Chris
__________________
aximbigfan is offline  
Reply With Quote
Old Mar 19, 2008, 07:15 AM   #2
aximbigfan
500 Posts
 
aximbigfan's Avatar
 
Join Date: Oct 2006
Location: St. Louis, MO
Posts: 554 (0.23/day)
Thanks: 51
Thanked 35 Times in 28 Posts
Send a message via AIM to aximbigfan

System Specs

Ok, it's fixed. another member on a another forum caught a spelling error in "response".


Chris
__________________
aximbigfan is offline  
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Overclocking is Easy! Get Results! Kursah Overclocking & Cooling 131 May 12, 2010 12:14 AM
Good Work Systems Fragpedal Elite Darksaber Reviews 3 Jul 30, 2007 12:02 PM
Violate the laws of physics:Windows Vista DRM SpoonMuffin General Software 43 Jan 19, 2007 02:46 AM
this bios work fine ??? Giux-900 Graphics Cards 2 Jan 5, 2006 05:12 AM


All times are GMT. The time now is 12:36 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
no new posts