Ajax can't get data from PHP to update on a live edit table

Hello guys, I’m working on this project that uses a live table edit style (works perfectly) but trying to include the twitter style follow and unfollow in one of the columns (The last one precisely) the php works well but I’ve having problems returning the data to ajax to post to another php script.

Below shows the major part of the script (The php and ajax). I included a php comment on the important area of interest.

[php]
$query_pag_data = "SELECT * FROM applicant_result WHERE year=’$year’ AND class= ‘$class’ ORDER by candidate_no ";

$uid=strip_tags($id);

$result_pag_data = mysql_query($query_pag_data) or die(‘MySql Error’ . mysql_error());

$finaldata = “”;
$tablehead= ‘’;
$tablehead= "


#
Applicant ID
Year
Class
$subject_1
$subject_2
$subject_3
$subject_4
$subject_5
Total
Status
Interview
";

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

$id=htmlentities($row[‘candidate_no’]);
$subject_1=htmlentities($row[‘subject_1’]);
$subject_2=htmlentities($row[‘subject_2’]);
$subject_3=htmlentities($row[‘subject_3’]);
$subject_4=htmlentities($row[‘subject_4’]);
$subject_5=htmlentities($row[‘subject_5’]);
$total=htmlentities($row[‘total’]);
$status=htmlentities($row[‘interview’]);
$uid= strip_tags($row[‘candidate_no’]);

/* HELLO FORUMITES, THIS IS THE MAJOR AREA OF FOCUS HERE */

if($status!=0){$button="

<span class=‘button following’ id=‘following<?php echo $uid; ?>’ onClick=‘follow_or_unfollow(<?php echo $uid; ?>,‘following’);’>Following

		<span style='display:none;' class='button follow' id='follow<?php echo $uid; ?>' onClick='follow_or_unfollow(<?php echo $uid; ?>,'follow');'>Follow</span>

";}

              else{

$button="

<span class=‘button follow’ id=‘follow<?php echo $uid; ?>’ onClick=‘follow_or_unfollow(<?php echo $uid; ?>,‘follow’);’>Follow

		<span class='button following' style='display:none;' id='following<?php echo $uid; ?>' onClick='follow_or_unfollow(<?php echo $uid; ?>,'following');'>Following</span>

";}

$tabledata.="

$counter $id $year $class $subject_1 $subject_2 $subject_3 $subject_4 $subject_5 $total $status $button "; $counter++;

}
$finaldata = “

”.$tablehead." ".$tabledata. “
”; // Content for Data

echo $finaldata;

/* NOW THE AJAX */
[/php]

[php]

[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service