SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    May 2007
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    need help with innerHTML

    I am getting data from two tables in a database using a dropdown box with a onchange and some ajax to update two diferent Div tags, basically the id is passed to a php page,, I grab the data from the two tables, I then echo the data in two html tables. I echo a ** for a delimiter between the two tables,

    Then I use a javascript split function to split the responseText into two peices so I can update each DIV with the coresponding data.

    Everything works in Firefox, but in IE7 only one div gets updated with its data, the other div will not change, and I get a unknown runtime error.

    However if I go into my php page and change the data I am echoing after the delimiter to a simple echo 'test'; it will work.

    So then I just tried to simplify a little more.

    I tried
    Code:
     echo '<table><tr><td>test</td></tr></table>';
    and it does not work with that either.

    Any ideas?

    here is some of the code.
    Code:
    $sql = mysql_query("SELECT * FROM `affiliates` WHERE affiliates_id='" . $_GET['company'] . "' "); 
    while($result = mysql_fetch_array($sql))
    {
    
    $affiliates_name = $result['affiliates_name'];
    $affiliates_address = $result['affiliates_address'];
    $affiliates_city = $result['affiliates_city'];
    $affiliates_state = $result['affiliates_state'];
    $affiliates_zip = $result['affiliates_zip'];
    $affiliates_contact_name = $result['affiliates_contact_name'];
    $affiliates_contact_phone = $result['affiliates_phone'];
    $affiliates_contact_ext = $result['affiliates_ext'];
    $affiliates_contact_fax = $result['affiliates_fax_number'];
    $affiliates_contact_cell = $result['affiliates_cell'];
    $affiliates_email_address = $result['affiliates_email_address'];
    
     }
    echo '<table><tr><td class="main">Affiliates Name:</td><td class="main"> ' . $affiliates_name . '</td></tr><tr><td class="main">' .
    'Affiliates Address: </td><td class="main"> ' . $affiliates_address . '</td></tr><tr><td class="main">' .
    'Affiliates City: </td><td class="main">' . $affiliates_city . '</td></tr><tr><td class="main">' .
    'Affiliates State: </td><td class="main">' . $affiliates_state . '</td></tr><tr><td class="main">' .
    'Affiliates Zip: </td><td class="main">' . $affiliates_zip . '</td></tr><tr><td class="main">' .
    'Affiliates Name: </td><td class="main">' . $affiliates_contact_name . '</td></tr><tr><td class="main">' .
    'Phone Number: </td><td class="main">' . $affiliates_contact_phone . '</td></tr><tr><td class="main">' .
    'Phone Ext: </td><td class="main">' . $affiliates_contact_ext . '</td></tr><tr><td class="main">' .
    'Fax Number: </td><td class="main">' . $affiliates_contact_fax . '</td></tr><tr><td class="main">' .
    'Cell Phone: </td><td class="main">' . $affiliates_contact_cell . '</td></tr><tr><td class="main">' .
    'Email Address: </td><td class="main">' . $affiliates_email_address . '</td></tr></table>' ;
    
    
    $sql = mysql_query("SELECT * FROM `affiliates_billing` WHERE affiliates_id='" . $_GET['company'] . "' "); 
    while($result = mysql_fetch_array($sql))
    {
    
    $billing_name = $result['billing_name'];
    $billing_address = $result['billing_address'];
    $billing_city = $result['billing_city'];
    $billing_state = $result['billing_state'];
    $billing_zip = $result['billing_zip'];
    $billing_type = $result['billing_type'];
    $billing_cc = $result['billing_cc'];
    $billing_exp = $result['billing_exp'];
    $billing_ccv = $result['billing_ccv'];
    $billing_bank_name = $result['billing_bank_name'];
    $billing_routing_num = $result['billing_routing_num'];
    $billing_account_num = $result['billing_acct_num'];
    $billing_approval_num = $result['billing_approval_num'];
    $billing_status = $result['billing_status'];
     }
    echo '**';
    echo '<table><tr><td class="main">Billing Name:</td><td class="main"> ' . $billing_name . '</td></tr><tr><td class="main">' .
    'Billing Address: </td><td class="main"> ' . $billing_address . '</td></tr><tr><td class="main">' .
    'Billing City: </td><td class="main">' . $billing_city . '</td></tr><tr><td class="main">' .
    'Billing State: </td><td class="main">' . $billing_state . '</td></tr><tr><td class="main">' .
    'Billing Zip: </td><td class="main">' . $billing_zip . '</td></tr><tr><td class="main">' .
    'Billing Type: </td><td class="main">' . $billing_type . '</td></tr><tr><td class="main">' .
    'Billing CC: </td><td class="main">' . $billing_cc . '</td></tr><tr><td class="main">' .
    'Billing Exp: </td><td class="main">' . $billing_exp . '</td></tr><tr><td class="main">' .
    'Billing CCV: </td><td class="main">' . $billing_ccv . '</td></tr><tr><td class="main">' .
    'Bank Name: </td><td class="main">' . $billing_bank_name . '</td></tr><tr><td class="main">' .
    'Routing Number: </td><td class="main">' . $billing_routing_num . '</td></tr><tr><td class="main">' .
    'Account Number: </td><td class="main">' . $billing_acct_num . '</td></tr><tr><td class="main">' .
    'Approval Number: </td><td class="main">' . $billing_approval_num . '</td></tr><tr><td class="main">' .
    'Status: </td><td class="main">' . $billing_status . '</td></tr></table>' ;
    Ive tested on a php page and I get my results just fine.


    Now here is my js page

    Code:
    <script language="JavaScript">
    
    	function submitFormAffiliates()
    	{ 
    		var req = null; 
    		
    		document.getElementById("affiliates").innerHTML = "Started...";
     
    		if (window.XMLHttpRequest)
    		{
     			req = new XMLHttpRequest();
    			if (req.overrideMimeType) 
    			{
    				req.overrideMimeType('text/xml');
    			}
    		} 
    		else if (window.ActiveXObject) 
    		{
    			try {
    				req = new ActiveXObject("Msxml2.XMLHTTP");
    			} catch (e)
    			{
    				try {
    					req = new ActiveXObject("Microsoft.XMLHTTP");
    				} catch (e) {}
    			}
    	        	}
    
    
    
    		req.onreadystatechange = function()
    		{ 
    			document.getElementById("affiliates").innerHTML = "Wait server...";
    			if(req.readyState == 4)
    			{
    				if(req.status == 200)
    				{
    				 ids = req.responseText.split("**");
    				 var affiliatesInfo = ids[0];
    				 var billingInfo = ids[1];
    					document.getElementById("affiliates").innerHTML  = affiliatesInfo ;
    					document.getElementById('affiliates_billing').innerHTML  = billingInfo ;
    				}	
    				else	
    				{
    					document.getElementById("affiliates").innerHTML="Error: returned status code " + req.status + " " + req.statusText;
    				}	
    			} 
    			
    						
    			
    		}; 
    		var content = document.getElementById("affiliate_dropdown").value ;
    		var url="includes/modules/affiliate_request.php?company="+ content;
    		req.open("GET", url, true); 
    		req.send(null); 
    	} 
    	</script>
    I want to offer thanks for any help in advance

  2. #2
    SitePoint Member
    Join Date
    May 2007
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I just narrowed the probem down some.

    if I take this code:

    Code:
    echo '**';
    echo '<table><tr><td class="main">Billing Name:</td><td class="main"> ' . $billing_name . '</td></tr><tr><td class="main">' .
    'Billing Address: </td><td class="main"> ' . $billing_address . '</td></tr><tr><td class="main">' .
    'Billing City: </td><td class="main">' . $billing_city . '</td></tr><tr><td class="main">' .
    'Billing State: </td><td class="main">' . $billing_state . '</td></tr><tr><td class="main">' .
    'Billing Zip: </td><td class="main">' . $billing_zip . '</td></tr><tr><td class="main">' .
    'Billing Type: </td><td class="main">' . $billing_type . '</td></tr><tr><td class="main">' .
    'Billing CC: </td><td class="main">' . $billing_cc . '</td></tr><tr><td class="main">' .
    'Billing Exp: </td><td class="main">' . $billing_exp . '</td></tr><tr><td class="main">' .
    'Billing CCV: </td><td class="main">' . $billing_ccv . '</td></tr><tr><td class="main">' .
    'Bank Name: </td><td class="main">' . $billing_bank_name . '</td></tr><tr><td class="main">' .
    'Routing Number: </td><td class="main">' . $billing_routing_num . '</td></tr><tr><td class="main">' .
    'Account Number: </td><td class="main">' . $billing_acct_num . '</td></tr><tr><td class="main">' .
    'Approval Number: </td><td class="main">' . $billing_approval_num . '</td></tr><tr><td class="main">' .
    'Status: </td><td class="main">' . $billing_status . '</td></tr></table>' ;
    and take out the <table> </table> tags, then it works,,, but of course the formating of the <tr> and <td> tags gets all screwed.

    Just cant understand why a simple table tag could cause such issues in IE7.

  3. #3
    SitePoint Enthusiast
    Join Date
    Oct 2007
    Location
    Sydney, Australia
    Posts
    27
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Are you sure you have provided all the content?

    I am not seeing any elements with an id of affiliates or affiliates_billing.

    Maybe this is the problem? Although i dont know understand how it would work at all if this was the case.
    Kind Regards,
    Steve
    http://www.rtepad.com


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •