Question : jQuery Dialog Ajax PHP problem

I am creating a wall that I want to refresh via ajax and I have a problem... I am trying to use PHP variables and the value of a textarea to form the query string that "data:" passes to my remote php script.

 I am using a "do...while" loop to output the "wall posts".  I use the "comment" link to open the dialog.  To pass relevant PHP variables that I need for my query in the remote script, I use the "name" attribute of the "comment" link to form part 1 of my query string.  Once the dialog is open, the user enters their comment into the textarea and upon submit, that comment is captured as part 2 of my query string and then I concatenate the 2 parts as one and send it away in the ajax request.

The problem is... it doesn't work.  I know that this is the problem because if I manually enter a query string to test it, the ajax request works and the new data is returned.

If you could help me out, I would appreciate it. Code attached. You can also see it not work using the link below :)

http://www.pltproject.org/testing18/test_shit/dialog_ajax_test.php
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
<?php 
require_once('../Connections/PLT.php'); 


mysql_select_db($database_PLT, $PLT); // Gets all wall posts
$query_wall_posts = "SELECT A1.user_id, A1.first_name, A1.last_name, A2.reply, A2.post_message, A2.timestamp, COALESCE(A2.reply_to_id, A2.post_id)reply_id  FROM users A1, wall_posts A2 WHERE A1.username = A2.from AND A2.to = 'joshua' ORDER BY reply_id DESC, timestamp";
$wall_posts = mysql_query($query_wall_posts, $PLT) or die(mysql_error());
$row_wall_posts = mysql_fetch_assoc($wall_posts);
$totalRows_wall_posts = mysql_num_rows($wall_posts);

?>

<!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=utf-8" />
<title>Untitled Document</title>
<link href="../includes18/jQuery/css/plt-theme/jquery-ui-1.8.2.custom.css" rel="stylesheet" type="text/css" />
<link href="../main.css" rel="stylesheet" type="text/css" />
<script src="../includes18/jQuery/js/jquery-1.4.2.min.js" type="text/javascript"></script>
<script src="../includes18/jQuery/js/jquery-ui-1.8.2.custom.min.js" type="text/javascript"></script>
<script src="../scripts/wall_buttons.js" type="text/javascript"></script>
<script type="text/javascript">
$(function() {   
		$("#comment_dialog").dialog({
			autoOpen: false,
			height: 180,
			width: 560,
			modal: true
		});
		$(".faux_link").click(function() {
				$('#comment_dialog').dialog('open');
				var data_part1 = $(this).attr('name');
		});
		$("#add_comment_button").click(function() {
					$("#comment_dialog").dialog('close');
					var query_string = data_part1 + $('#comment_input').val();
					$.ajax({
						url: "../scripts/comment_dialog.php",
						dataType: "html",
						data: query_string,
						success: function(data){
							$('#wall_post_cont').html(data);
						}
					});
		});
});
	</script>
	
    </head>
<body style="background-color:#FFF;">
    
<div id="desktop_right">
<div id="wall_post_cont">
   <?php if($totalRows_wall_posts > 0) { //show if recordest is not empty ?>
						<?php do { ?> 
                            <?php if ($row_wall_posts['reply'] == 'N') { //show if not reply ?>
                            <div class = "wall_post">
                                <div class = "poster_img">
                                </div>
                                <div class = "post">
                                    <a href="visitor.php?i=<?php echo $row_wall_posts['user_id']?>"><strong><?php echo $row_wall_posts['first_name'] . ' ' . $row_wall_posts['last_name']; ?></strong></a> <?php echo $row_wall_posts['post_message']; ?><br /><span style="line-height: 2.0; font-size:10px; "><?php echo date('F j, Y at g:ia', strtotime($row_wall_posts['timestamp'])); ?> | <span class="faux_link" name="<?php echo "reply_id=" . $row_wall_posts['reply_id'] . "&to=" . $row_user_info['username'] . "&from=" . $_SESSION['MM_Username'] . "&post_message="; ?>">Comment</span></span> 
                              	</div>
                                <div class="remove_button_cont">
                                 	<button style="float:right;">Remove</button>
                                </div>
                            </div>
                            <?php } // Show if not reply ?>
                            
                            <?php if ($row_wall_posts['reply'] == 'Y') { //show if reply ?>
                            <div class="reply_cont">
                                <div class="reply_top">
                                </div>
                                <div class="reply_img">
                                </div>
                                <div class="reply">
                                	 <a href="visitor.php?i=<?php echo $row_wall_posts['user_id']?>"><strong><?php echo $row_wall_posts['first_name'] . ' ' . $row_wall_posts['last_name']; ?></strong></a> <?php echo $row_wall_posts['post_message']; ?><br /><span style="line-height: 2.0;"><?php echo date('F j, Y at g:ia', strtotime($row_wall_posts['timestamp'])); ?> | <span class="faux_link" name="<?php echo "reply_id=" . $row_wall_posts['reply_id'] . "&to=" . $row_user_info['username'] . "&from=" . $_SESSION['MM_Username'] . "&post_message="; ?>">Comment</span><!-- I'm setting this name attr with my ajax data to be sent--></span> 
                                </div>
                            </div>
                            <?php } // Show if reply ?>
                        <?php } while ($row_wall_posts = mysql_fetch_assoc($wall_posts)); ?>
                    <?php } // Show if recordset is empty ?> 
                    </div>
                    </div>
                    
<div id="comment_dialog" title="Comment">
  	<textarea style="margin-top: 15px;" name="comment_input" rows="3" id="comment_input" ></textarea>
    <span style="float:right; margin-top:10px; font-size:12px">
        <input id="add_comment_button" class="input_button" name="submit" type="submit" value="Submit" />
    </span>
</div>
</body>
</html>

Answer : jQuery Dialog Ajax PHP problem

You are not stating the exact "Graphical" Output you are seeking.

My guess is that you want to see a unique list of all used dates and along with each of these dates you want to see the associated Topics, Cases, ...etc

I am not sure that Access can represent the query you are after, but this can easily be done with a Report and two subreports.
The Main Report being the list of unique, used dates
The two subreports being the Cases and Topics tables respectively.
The subreports are linked on the unique date to their corresponding dates.

Here is a sample.
The Report is named: rptDatesCasesTopics
If this is what you wanted, I am sure that you can modify it to fit your needs.

;-)

JeffCoachman
Random Solutions  
 
programming4us programming4us