Jump to content

Help!!!!! I need help to display ajax results in a table, columns and rows.....


designsecrets

Recommended Posts

I've done this in php before displaying rows and columns, but haven't been able to work out the logic about doing this in an ajax result.  I'm pretty new to ajax, so I'm learning as I go.  Basically the idea is that the user selects a location, and a type of product.  http://thehenco.co.nz/activities.php#  , this will display images that can be clicked on for more information.  No matter what I do, I can't work out how to <td> and <tr> in a table to display the results nicely.  Every time i try to display the activity_name, the whole structure stops going across the page, but down it......I would love to work out what I'm doing wrong, as I'm struggling with this one.....  (at the moment this wont' display right in fire fox, thats another issue with how i'm displaying the result).

 

<?php

include 'XML/Unserializer.php';
/*
Section: Standard xajax startup

- include <xajax.inc.php>
- instantiate main <xajax> object
*/
require ('xajax_core/xajax.inc.php');
$xajax = new xajax();

/*
- enable deubgging if desired
- set the javascript uri (location of xajax js files)
*/
//$xajax->configure('debug', true);
$xajax->configure('javascript URI', '../');

function goGetActivities($type, $location)
{

include 'db.content.php';

if ($type == NULL OR $location == NULL) {

	$content = 'one of your variables isnt here';

} else {

	$acts = mysql_query("SELECT * FROM activities WHERE activity_type LIKE '%$type%' AND activity_location LIKE '%$location%'");

	while($row = mysql_fetch_array($acts)) {

		//$actsinarea .= $row[activity_title].' with '.$row[activity_supplier].'<br/>';

			$image = $row[activity_thumb_image];
			$activity_id = $row[activity_id];
			$activity_name = $row[activity_name];

		//$actsinarea .= $row[activity_title].' with <img src=\gallery/activity/small/small_'.$image.' WIDTH=100 HEIGHT=100 ><br/>';

		$actsinarea .= '<a href="activities_details.php?&activity_id='.$activity_id.' "><img src=\gallery/activity/crop/'.$image.'.jpg width="100" height="100" >'.$activity_name.'</a> ';

	}

	$content = 'Activity: '.$type.'<br/>Location: '.$location.'<br/><br/>'.$actsinarea;

}

$objResponse = new xajaxResponse();
$objResponse->assign('hen-co-activities', 'innerHTML', $content);

return $objResponse;

}




$xajax->register(XAJAX_FUNCTION,"goGetActivities");



/*
Section: processRequest

This will detect an incoming xajax request, process it and exit.  If this is
not a xajax request, then it is a request to load the initial contents of the page
(HTML).

Everything prior to this statement will be executed upon each request (whether it
is for the initial page load or a xajax request.  Everything after this statement
will be executed only when the page is first loaded.
*/
$xajax->processRequest();


?>

<!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>

<title>The Hen Co - The Ultimate Hens Party Planners!</title>
<? include("meta_tags.html");  ?> 

<meta name="description" content="New Zealand's Best Hen's Night Planners!" />
<meta name="keywords" content="Hens party, hens night, auckland hens party, hens night party, hens night activities" />
<link rel="shortcut icon" href="favicon.ico" />

<link rel="stylesheet" type="text/css" href="css/master.css">

<script type="text/javascript" src="highslide/highslide-with-html.js"></script>
<script type="text/javascript" src="show_layer.js"></script>


<link rel="stylesheet" type="text/css" href="css/highslide.css" />
<link rel="stylesheet" type="text/css" href="css/menu_style.css" />

<script type="text/javascript"> 
hs.graphicsDir = 'highslide/graphics/';
hs.outlineType = 'rounded-white';
hs.showCredits = false;
hs.wrapperClassName = 'draggable-header';
</script>


<?php
// output the xajax javascript. This must be called between the head tags
$xajax->printJavascript();
?>

<script type="text/javascript">

function setTown(town) {

document.getElementById('townHolder').value = town;
activity = document.getElementById('actHolder').value;
xajax_goGetActivities(activity,town);

}

function getActivities(activity) {

town = document.getElementById('townHolder').value;
document.getElementById('actHolder').value = activity;
xajax_goGetActivities(activity,town);

}

</script>
</head>

<body>

<div id="main-container">

<div id="middle-container">

	<div id="hen-co-menu-bar">	
            
          <div id="hen-co-menu-bar-logo">              		
                                
                <img src="images/The_Hen_Co_Logo.jpg" alt="The Hen Co" width="92" height="110" longdesc="images/The_Hen_Co_Logo.jpg" />           	   
                    
            </div><!-- hen-co-menu-bar-logo -->
                
            <div id="hen-co-menu-bar-menu-nav-bar">
            
            	<div id="hen-co-menu-bar-messages-position">
            
            		<? include("messages.html");  ?>  
               
                 </div>
            
            	<div id="hen-co-menu-bar-menu-nav-bar-position">
                         
            	 	<? include("menu.html"); ?>  
                 
                 </div>
                           
            </div><!-- hen-co-menu-bar-menu-nav-bar -->        
         
      </div><!-- hen-co-menu-bar -->
      
      
   
      
       <div id="hen-co-content">
       
          
          
          
          
                <div id="hen-co-main-slide-show">
                
                	<? include("activity-main-slide-show.html"); ?>  
                
                </div><!-- hen-co-main-slide-show-->
              
                <div id="hen-co-activity-locations">
                
                	<? include("activity-locations.html"); ?>  
                
                </div><!--hen-co-activity-locations-->
                
                <div id="hen-co-activity-types">
                
                	
                
                    <? include("activity-types.html"); ?>  
                           
                
                </div><!--hen-co-activity-types-->
          
          </div><!--hen-co-content-->
           
                  
         
         <div id="hen-co-activities">        
          
	  
           
           
         </div><!-- hen-co-activities-->
             
          
        
         
         <div id="pink-bar">
         
         	<div id="pink-bar-footer">
         
         	   <? include("text/footer.html");  ?>  
               
            </div>   
         
         </div><!--pink-bar-->
      
            
      </div><!-- hen-co-content-->
      
      
  </div>
  
  
</div>

<input type="hidden" name="townHolder" id="townHolder" value="">
<input type="hidden" name="actHolder" id="actHolder" value="">

</body>
</html>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.