Jump to content

Ajax doesn't return value


sniperscope

Recommended Posts

Hi

I have some problem with ajax.

My script connect query page but doesn't return any value.

 

Regards

Note: In same page DELETE function works fine but not display.

Here is my index.php:

 

<script type="text/javascript">

$(function()
{
	$(".showme").click(function()
	{
		var commentContainer = $(this).parent();
		var id = $(this).attr("imd");
		var string = 'id='+ id ;

		$.ajax({
			type: "POST",
			url: "sql/reservation.php",
			data: string,
			cache: false,
			success: function()
			{
				$('#ajaxDiv').html(data);
			}
		});
	});
});
</script>

<?php

while($ROW = mysql_fetch_array($SQL))
{
echo '<li style="text-align:right; width:100%;">' .$i;
if($ROW['is_read'] == 0) echo '  <img src="images/email_unread.png" /> '; else echo '  <img src="images/email_read.png" /> ';
echo '<a href="#" imd="' .$ROW['id']. '" class="showme">'. date("Y-n-d H:i", $ROW['RegDate']).'</a>';
$i++;
}
?>
<div class="ajaxDiv" id="ajaxDiv"></div>

 

And this is reservation.php:

<?php
include('../inc/cn.php');
$SQL = "SELECT * FROM reservation WHERE id = '" .$_POST['id']. "' LIMIT 1";
$SQL = mysql_query($SQL);
$ROW = mysql_fetch_array($SQL);

// Test purpose to see that if ajax connect this page or not.
//	$fp = fopen("sql.txt", 'a');
//	fwrite($fp, $SQL);
//	fclose($fp);

echo '<table width="100%" cellpadding="3" cellspacing="1" border="0" bgcolor="#000000">
	<tr><td><table width="100%" border="0" cellspacing="1" cellpadding="4" bgcolor="#999999">
		<tr><td width="100" bgcolor="#FFFFE5">name</td><td bgcolor="#FFFFFF">' .$ROW['Name']. '</td></tr>
		<tr><td bgcolor="#FFFFE5">date</td><td bgcolor="#FFFFFF">' .$ROW['resDate']. '</td></tr>
		<tr><td bgcolor="#FFFFE5">user id</td><td bgcolor="#FFFFFF">' .$ROW['memID']. '     '; if($ROW['is_new'] == 1) echo '<span style="font-weight:bold; color:red;">new user</span>';
			echo '</td></tr>
		<tr><td bgcolor="#FFFFE5">email add</td><td bgcolor="#FFFFFF"><a href="mailto:' .$ROW['memMail']. '">' .$ROW['memMail']. '</a></td></tr>
		<tr><td bgcolor="#FFFFE5">phone</td><td bgcolor="#FFFFFF">' .$ROW['memPhone']. '</td></tr>
		<tr><td bgcolor="#FFFFE5">remarks</td><td bgcolor="#FFFFFF">' .nl2br($ROW['memQuest']). '</td></tr></table>
	</td></tr>
</table>';
?>

Link to comment
https://forums.phpfreaks.com/topic/245477-ajax-doesnt-return-value/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.