Jump to content

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

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.