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
Old 02-03-2007, 06:14 AM AJAX Questions
Super Talker

Posts: 124
Name: Chris
Trades: 0
Ok I am pretty new to AJAX, not coding though at least the PHP aspect.

I'm having an issue with writing the response from the server to the page.

HTML Code:
<?php
include("sqlclass.inc.php");
?>

<!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>Client Tracking</title>
    <script type="text/javascript" src="prototype.js"></script>
    <script type="text/javascript">
        /* Create a new XMLHttpRequest object to talk to the Web server */
        var http = false;
        /*@cc_on @*/
        /*@if (@_jscript_version >= 5)
        try {
          http = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
          try {
            http = new ActiveXObject("Microsoft.XMLHTTP");
          } catch (e2) {
            http = false;
          }
        }
        @end @*/

        if (!http && typeof XMLHttpRequest != 'undefined') {
          http = new XMLHttpRequest();
        }

        function showClients(orderby, type) {
            http.open('get','show_clients.php?orderby='+orderby+'&type='+type);
            http.onreadystatechange = showClientOutput;
            http.send(null);
        }

        function showClientOutput() {
            if (http.readyState == 1) {
                document.getElementById('info').innerHtml = "Loading...";
            }

            if (http.readyState == 4) {
                var response = http.responseText;
                document.getElementById('info').innerHtml = response;
            }
        }
    </script>

    <style type="text/css">
        body {
            font: 10px Verdana;
        }
    </style>

</head>
<body onLoad="showClients('business_name','ASC');">
    <div id="info"></div>
</body>
</html>
There is my code at the moment. It works fine and dandy if I output it to an alert. So I know the html is coming back. So something is wrong with my:

document.getElementById('info').innerHtml = response;

It works if I use document.write or alert() but not if I use value or innerHtml.
__________________
Chris - Trying to help others and learn myself!

Please login or register to view this content. Registration is FREE
ctess is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 02-03-2007, 07:53 AM Re: AJAX Questions
Skilled Talker

Posts: 96
Name: Tudor Barbu
Trades: 0
Bacause the variabile names are CaSE SenSiTIve. Use innerHTML, not innerHtml.
__________________

Please login or register to view this content. Registration is FREE
Tudor.b is offline
Reply With Quote
View Public Profile Visit Tudor.b's homepage!
 
Old 02-03-2007, 01:29 PM Re: AJAX Questions
Super Talker

Posts: 124
Name: Chris
Trades: 0
yeah figured that out late last night. innerHTML isn't a variable silly
__________________
Chris - Trying to help others and learn myself!

Please login or register to view this content. Registration is FREE
ctess is offline
Reply With Quote
View Public Profile
 
Old 02-05-2007, 01:10 AM Re: AJAX Questions
saadatshah's Avatar
Extreme Talker

Posts: 215
Name: Syed Saadat Ali
Location: Lahore, Pakistan
Trades: 0
yeps its a property defined in DOM
__________________
- -- --- ---- ----- ------ ------- ---------------
If you have knowledge, let others light their candles in it.
saadatshah is offline
Reply With Quote
View Public Profile Visit saadatshah's homepage!
 
Old 02-05-2007, 02:43 AM Re: AJAX Questions
Skilled Talker

Posts: 96
Name: Tudor Barbu
Trades: 0
For your information, innerHTML is a variable!!!
__________________

Please login or register to view this content. Registration is FREE
Tudor.b is offline
Reply With Quote
View Public Profile Visit Tudor.b's homepage!
 
Old 02-05-2007, 03:21 AM Re: AJAX Questions
saadatshah's Avatar
Extreme Talker

Posts: 215
Name: Syed Saadat Ali
Location: Lahore, Pakistan
Trades: 0
FYI here goes the article
http://www.w3schools.com/htmldom/pro..._innerhtml.asp
__________________
- -- --- ---- ----- ------ ------- ---------------
If you have knowledge, let others light their candles in it.
saadatshah is offline
Reply With Quote
View Public Profile Visit saadatshah's homepage!
 
Old 02-05-2007, 07:02 AM Re: AJAX Questions
Skilled Talker

Posts: 96
Name: Tudor Barbu
Trades: 0
Do you at least know what a variable is?
__________________

Please login or register to view this content. Registration is FREE
Tudor.b is offline
Reply With Quote
View Public Profile Visit Tudor.b's homepage!
 
Old 02-05-2007, 07:40 AM Re: AJAX Questions
saadatshah's Avatar
Extreme Talker

Posts: 215
Name: Syed Saadat Ali
Location: Lahore, Pakistan
Trades: 0
you are just arguing now
__________________
- -- --- ---- ----- ------ ------- ---------------
If you have knowledge, let others light their candles in it.
saadatshah is offline
Reply With Quote
View Public Profile Visit saadatshah's homepage!
 
Old 02-05-2007, 05:32 PM Re: AJAX Questions
Skilled Talker

Posts: 96
Name: Tudor Barbu
Trades: 0
Dude, spend some time in school and then come back...Or at least take a look in Wikipedia!
__________________

Please login or register to view this content. Registration is FREE
Tudor.b is offline
Reply With Quote
View Public Profile Visit Tudor.b's homepage!
 
Old 02-06-2007, 12:22 AM Re: AJAX Questions
saadatshah's Avatar
Extreme Talker

Posts: 215
Name: Syed Saadat Ali
Location: Lahore, Pakistan
Trades: 0
Every property has a variable behind it. But it doesnt mean that you can call any property a variable. Anywayz I dont want any arguments over it so just for ending the argument let me say;
YOU WON.
NOW HAPPY?
__________________
- -- --- ---- ----- ------ ------- ---------------
If you have knowledge, let others light their candles in it.

Last edited by saadatshah; 02-06-2007 at 03:03 AM..
saadatshah is offline
Reply With Quote
View Public Profile Visit saadatshah's homepage!
 
Old 02-06-2007, 12:44 AM Re: AJAX Questions
dionak's Avatar
Experienced Talker

Posts: 45
Name: Diona Kidd
Trades: 0
ctess,

Despite the little tiff here, did your issue get resolved? Hope so...
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE

dionak is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to AJAX Questions
 

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